From 806570cbafc5dd974d64fd42ff2c5c66e48bda18 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Tue, 17 Dec 2013 18:14:19 +0200 Subject: [PATCH] added back set caching --- engine/storage_map.go | 4 ++++ engine/storage_redis.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/engine/storage_map.go b/engine/storage_map.go index 6e25cbd1a..845347784 100644 --- a/engine/storage_map.go +++ b/engine/storage_map.go @@ -116,6 +116,7 @@ func (ms *MapStorage) SetRatingPlan(rp *RatingPlan) (err error) { ms.dict[RATING_PLAN_PREFIX+rp.Id] = result response := 0 go historyScribe.Record(&history.Record{RATING_PLAN_PREFIX + rp.Id, rp}, &response) + cache2go.Cache(RATING_PLAN_PREFIX+rp.Id, rp) return } @@ -143,6 +144,7 @@ func (ms *MapStorage) SetRatingProfile(rpf *RatingProfile) (err error) { ms.dict[RATING_PROFILE_PREFIX+rpf.Id] = result response := 0 go historyScribe.Record(&history.Record{RATING_PROFILE_PREFIX + rpf.Id, rpf}, &response) + cache2go.Cache(RATING_PROFILE_PREFIX+rpf.Id, rpf) return } @@ -179,6 +181,7 @@ func (ms *MapStorage) SetDestination(dest *Destination) (err error) { ms.dict[DESTINATION_PREFIX+dest.Id] = result response := 0 go historyScribe.Record(&history.Record{DESTINATION_PREFIX + dest.Id, dest}, &response) + cache2go.Cache(DESTINATION_PREFIX+dest.Id, dest) return } @@ -209,6 +212,7 @@ func (ms *MapStorage) GetActions(key string, checkDb bool) (as Actions, err erro func (ms *MapStorage) SetActions(key string, as Actions) (err error) { result, err := ms.ms.Marshal(&as) ms.dict[ACTION_PREFIX+key] = result + cache2go.Cache(ACTION_PREFIX+key, as) return } diff --git a/engine/storage_redis.go b/engine/storage_redis.go index 359f5a9a0..93b14da8a 100644 --- a/engine/storage_redis.go +++ b/engine/storage_redis.go @@ -190,6 +190,7 @@ func (rs *RedisStorage) SetRatingPlan(rp *RatingPlan) (err error) { response := 0 go historyScribe.Record(&history.Record{RATING_PLAN_PREFIX + rp.Id, rp}, &response) } + cache2go.Cache(RATING_PLAN_PREFIX+rp.Id, rp) return } @@ -217,6 +218,7 @@ func (rs *RedisStorage) SetRatingProfile(rpf *RatingProfile) (err error) { response := 0 go historyScribe.Record(&history.Record{RATING_PROFILE_PREFIX + rpf.Id, rpf}, &response) } + cache2go.Cache(RATING_PROFILE_PREFIX+rpf.Id, rpf) return } @@ -273,6 +275,7 @@ func (rs *RedisStorage) SetDestination(dest *Destination) (err error) { response := 0 go historyScribe.Record(&history.Record{DESTINATION_PREFIX + dest.Id, dest}, &response) } + cache2go.Cache(DESTINATION_PREFIX+dest.Id, dest) return } @@ -295,6 +298,7 @@ func (rs *RedisStorage) GetActions(key string, checkDb bool) (as Actions, err er func (rs *RedisStorage) SetActions(key string, as Actions) (err error) { result, err := rs.ms.Marshal(&as) err = rs.db.Set(ACTION_PREFIX+key, result) + cache2go.Cache(ACTION_PREFIX+key, as) return }