mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-13 11:06:25 +05:00
CacheSv1.RemoveItem API
This commit is contained in:
@@ -33,14 +33,20 @@ type CacheSv1 struct {
|
||||
cacheS *engine.CacheS
|
||||
}
|
||||
|
||||
// GetItemExpiryTime returns the expiryTime for an item
|
||||
func (chSv1 *CacheSv1) GetItemIDs(args *engine.ArgsGetCacheItemIDs,
|
||||
reply *[]string) error {
|
||||
return chSv1.cacheS.V1GetItemIDs(args, reply)
|
||||
}
|
||||
|
||||
// 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)
|
||||
// RemoveItem removes the Item with ID from cache
|
||||
func (chSv1 *CacheSv1) RemoveItem(args *engine.ArgsGetCacheItem,
|
||||
reply *string) error {
|
||||
return chSv1.cacheS.V1RemoveItem(args, reply)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
2
glide.lock
generated
2
glide.lock
generated
@@ -16,7 +16,7 @@ imports:
|
||||
- name: github.com/cgrates/kamevapi
|
||||
version: e4dfe7d6cb5bb0872111fe7d61af0e1a19eda485
|
||||
- name: github.com/cgrates/ltcache
|
||||
version: 3aface1319c71e5050445fc659361a59bbeeedff
|
||||
version: d3381f22fae3c21703341cf13aad50f116862ebd
|
||||
- name: github.com/cgrates/osipsdagram
|
||||
version: 3d6beed663452471dec3ca194137a30d379d9e8f
|
||||
- name: github.com/cgrates/radigo
|
||||
|
||||
Reference in New Issue
Block a user