CacheSv1.GetItemIDs API

This commit is contained in:
DanB
2018-03-08 10:21:42 +01:00
parent cf0ec891cf
commit f3ce00bc3f
2 changed files with 22 additions and 1 deletions

View File

@@ -33,8 +33,14 @@ type CacheSv1 struct {
cacheS *engine.CacheS
}
// GetItemExpiryTime re
// GetItemExpiryTime returns the expiryTime for an item
func (chSv1 *CacheSv1) GetItemExpiryTime(args *engine.ArgsGetCacheItem,
reply *time.Time) error {
return chSv1.cacheS.V1GetItemExpiryTime(args, reply)
}
// GetItemExpiryTime returns the expiryTime for an item
func (chSv1 *CacheSv1) GetItemIDs(args *engine.ArgsGetCacheItemIDs,
reply *[]string) error {
return chSv1.cacheS.V1GetItemIDs(args, reply)
}

View File

@@ -125,3 +125,18 @@ 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
}
return
}