added back set caching

This commit is contained in:
Radu Ioan Fericean
2013-12-17 18:14:19 +02:00
parent c0d7cf0001
commit 806570cbaf
2 changed files with 8 additions and 0 deletions

View File

@@ -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
}

View File

@@ -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
}