(prefix, query string, whereArgs []interface{})
| 135 | } |
| 136 | |
| 137 | func (a *Api) cachedOrQuery(prefix, query string, whereArgs []interface{}) []client { |
| 138 | var result []client |
| 139 | if cl, ok := a.cache.Get(prefix + toQuery(query, whereArgs)); ok { |
| 140 | result = cl.([]client) |
| 141 | } else { |
| 142 | var err error |
| 143 | result, err = clientQuery(a.db, query, whereArgs...) |
| 144 | if err != nil { |
| 145 | log.Error("Failure in the query", "err", err) |
| 146 | } |
| 147 | } |
| 148 | return result |
| 149 | } |
| 150 | |
| 151 | func toQuery(query string, whereArgs []interface{}) string { |
| 152 | var res string |
no test coverage detected