Commit 1633dcca authored by Ajit Jagtap's avatar Ajit Jagtap
Browse files

Merge branch 'Roshanp-Cachechanges' into 'devbranch'

cache mdl get all items added

See merge request !69
parents aa9f793f 7c47bde6
1 merge request!69cache mdl get all items added
Showing with 32 additions and 30 deletions
...@@ -90,6 +90,10 @@ func (fastCacheHelper *FastCacheHelper) Get(key string) (interface{}, bool) { ...@@ -90,6 +90,10 @@ func (fastCacheHelper *FastCacheHelper) Get(key string) (interface{}, bool) {
return fastCacheHelper.FastCache.Get(key) return fastCacheHelper.FastCache.Get(key)
} }
func (fastCacheHelper *FastCacheHelper) GetItems() map[string]cache.Item {
return fastCacheHelper.FastCache.Items()
}
func (fastCacheHelper *FastCacheHelper) SetNoExpiration(key string, object interface{}) { func (fastCacheHelper *FastCacheHelper) SetNoExpiration(key string, object interface{}) {
fastCacheHelper.FastCache.Set(key, object, cache.NoExpiration) fastCacheHelper.FastCache.Set(key, object, cache.NoExpiration)
} }
......
...@@ -7,11 +7,9 @@ ...@@ -7,11 +7,9 @@
package loggermdl package loggermdl
import ( import (
"encoding/json"
"fmt" "fmt"
"os" "os"
"github.com/TylerBrock/colorjson"
logging "github.com/op/go-logging" logging "github.com/op/go-logging"
goon "github.com/shurcooL/go-goon" goon "github.com/shurcooL/go-goon"
) )
...@@ -58,42 +56,42 @@ func LogPanic(args ...interface{}) { ...@@ -58,42 +56,42 @@ func LogPanic(args ...interface{}) {
log.Panic(args) log.Panic(args)
} }
// LogJSONObject Format string // // LogJSONObject Format string
func LogJSONObject(pobj interface{}) { // func LogJSONObject(pobj interface{}) {
jsonByte, _ := json.Marshal(pobj) // jsonByte, _ := json.Marshal(pobj)
var objnew map[string]interface{} // var objnew map[string]interface{}
json.Unmarshal(jsonByte, &objnew) // json.Unmarshal(jsonByte, &objnew)
f := colorjson.NewFormatter() // f := colorjson.NewFormatter()
f.Indent = 2 // f.Indent = 2
s, _ := f.Marshal(objnew) // s, _ := f.Marshal(objnew)
fmt.Println(string(s)) // fmt.Println(string(s))
} // }
// LogJSONByte Format string // // LogJSONByte Format string
func LogJSONByte(pobj []byte) { // func LogJSONByte(pobj []byte) {
var objnew map[string]interface{} // var objnew map[string]interface{}
json.Unmarshal(pobj, &objnew) // json.Unmarshal(pobj, &objnew)
f := colorjson.NewFormatter() // f := colorjson.NewFormatter()
f.Indent = 2 // f.Indent = 2
s, _ := f.Marshal(objnew) // s, _ := f.Marshal(objnew)
fmt.Println(string(s)) // fmt.Println(string(s))
} // }
// LogJSONString Format string // // LogJSONString Format string
func LogJSONString(str string) { // func LogJSONString(str string) {
var objnew map[string]interface{} // var objnew map[string]interface{}
json.Unmarshal([]byte(str), &objnew) // json.Unmarshal([]byte(str), &objnew)
f := colorjson.NewFormatter() // f := colorjson.NewFormatter()
f.Indent = 2 // f.Indent = 2
s, _ := f.Marshal(objnew) // s, _ := f.Marshal(objnew)
fmt.Println(string(s)) // fmt.Println(string(s))
} // }
// LogHRStart can end line with <<< // LogHRStart can end line with <<<
func LogHRStart() { func LogHRStart() {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment