CacheSv1.RemoveItem API

This commit is contained in:
DanB
2018-03-08 18:51:23 +01:00
parent f3ce00bc3f
commit 8f8eebfda5
3 changed files with 30 additions and 17 deletions

View File

@@ -111,6 +111,21 @@ func (chS *CacheS) Precache() (err error) {
return
}
type ArgsGetCacheItemIDs struct {
CacheID string
ItemIDPrefix string
}
func (chS *CacheS) V1GetItemIDs(args *ArgsGetCacheItemIDs,
reply *[]string) (err error) {
if itmIDs := Cache.GetItemIDs(args.CacheID, args.ItemIDPrefix); len(itmIDs) == 0 {
return utils.ErrNotFound
} else {
*reply = itmIDs
}
return
}
type ArgsGetCacheItem struct {
CacheID string
ItemID string
@@ -126,17 +141,9 @@ func (chS *CacheS) V1GetItemExpiryTime(args *ArgsGetCacheItem,
return
}
type ArgsGetCacheItemIDs struct {
CacheID string
ItemIDPrefix string
}
func (chS *CacheS) V1GetItemIDs(args *ArgsGetCacheItemIDs,
reply *[]string) (err error) {
if itmIDs := Cache.GetItemIDs(args.CacheID, args.ItemIDPrefix); len(itmIDs) == 0 {
return utils.ErrNotFound
} else {
*reply = itmIDs
}
func (chS *CacheS) V1RemoveItem(args *ArgsGetCacheItem,
reply *string) (err error) {
Cache.Remove(args.CacheID, args.ItemID, true, utils.NonTransactional)
*reply = utils.OK
return
}