mirror of
https://github.com/kevin-DL/m3o-go.git
synced 2026-01-11 18:44:26 +00:00
Commit from m3o/m3o action
This commit is contained in:
10
cache/cache.go
vendored
10
cache/cache.go
vendored
@@ -18,32 +18,42 @@ type CacheService struct {
|
||||
|
||||
// Decrement a value (if it's a number). If key not found it is equivalent to set.
|
||||
func (t *CacheService) Decrement(request *DecrementRequest) (*DecrementResponse, error) {
|
||||
|
||||
rsp := &DecrementResponse{}
|
||||
return rsp, t.client.Call("cache", "Decrement", request, rsp)
|
||||
|
||||
}
|
||||
|
||||
// Delete a value from the cache. If key not found a success response is returned.
|
||||
func (t *CacheService) Delete(request *DeleteRequest) (*DeleteResponse, error) {
|
||||
|
||||
rsp := &DeleteResponse{}
|
||||
return rsp, t.client.Call("cache", "Delete", request, rsp)
|
||||
|
||||
}
|
||||
|
||||
// Get an item from the cache by key. If key is not found, an empty response is returned.
|
||||
func (t *CacheService) Get(request *GetRequest) (*GetResponse, error) {
|
||||
|
||||
rsp := &GetResponse{}
|
||||
return rsp, t.client.Call("cache", "Get", request, rsp)
|
||||
|
||||
}
|
||||
|
||||
// Increment a value (if it's a number). If key not found it is equivalent to set.
|
||||
func (t *CacheService) Increment(request *IncrementRequest) (*IncrementResponse, error) {
|
||||
|
||||
rsp := &IncrementResponse{}
|
||||
return rsp, t.client.Call("cache", "Increment", request, rsp)
|
||||
|
||||
}
|
||||
|
||||
// Set an item in the cache. Overwrites any existing value already set.
|
||||
func (t *CacheService) Set(request *SetRequest) (*SetResponse, error) {
|
||||
|
||||
rsp := &SetResponse{}
|
||||
return rsp, t.client.Call("cache", "Set", request, rsp)
|
||||
|
||||
}
|
||||
|
||||
type DecrementRequest struct {
|
||||
|
||||
Reference in New Issue
Block a user