Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cache
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gaia-X
Trust Services API
cache
Commits
c43aca38
Commit
c43aca38
authored
3 years ago
by
Lyuben Penkovski
Committed by
Yordan Kinkov
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Apply 4 suggestion(s) to 3 file(s)
parent
d2125545
No related branches found
No related tags found
1 merge request
!3
Create SET cache endpoint
Pipeline
#49803
passed
3 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+2
-2
2 additions, 2 deletions
README.md
design/design.go
+1
-1
1 addition, 1 deletion
design/design.go
internal/service/cache/service.go
+1
-1
1 addition, 1 deletion
internal/service/cache/service.go
with
4 additions
and
4 deletions
README.md
+
2
−
2
View file @
c43aca38
...
...
@@ -12,9 +12,9 @@ flowchart LR
### API Documentation
The API Documentation is accessible at
`/swagger-ui`
path in OAS 3.0 format.
Example:
`localhost:8080/swagger-ui`
Example:
`
http://
localhost:8080/swagger-ui`
###
Prerequisit
es
###
Dependenci
es
There must be a running instance of
[
Redis
](
https://redis.io/
)
visible to the service.
The address, username and password of the Redis in-memory store instance must be provided as environment variables.
...
...
This diff is collapsed.
Click to expand it.
design/design.go
+
1
−
1
View file @
c43aca38
...
...
@@ -64,7 +64,7 @@ var _ = Service("cache", func() {
})
Method
(
"Set"
,
func
()
{
Description
(
"Set
value in the cache. The HTTP request body is stored as
value
and
the
key is assembled from HTTP request headers
."
)
Description
(
"Set
a JSON
value
in
the
cache
."
)
Payload
(
CacheSetRequest
)
Result
(
Empty
)
...
...
This diff is collapsed.
Click to expand it.
internal/service/cache/service.go
+
1
−
1
View file @
c43aca38
...
...
@@ -53,7 +53,7 @@ func (s *Service) Get(ctx context.Context, req *cache.CacheGetRequest) ([]byte,
func
(
s
*
Service
)
Set
(
ctx
context
.
Context
,
req
*
cache
.
CacheSetRequest
)
error
{
var
operation
=
zap
.
String
(
"operation"
,
"set"
)
if
req
.
Key
==
""
||
req
.
Namespace
==
""
||
req
.
Scope
==
""
||
len
(
req
.
Data
.
(
map
[
string
]
interface
{}))
==
0
{
if
req
.
Key
==
""
||
req
.
Namespace
==
""
||
req
.
Scope
==
""
{
s
.
logger
.
Error
(
"bad request: missing key or namespace or scope or data"
,
operation
)
return
errors
.
New
(
errors
.
BadRequest
,
"bad request"
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment