Stats will make two calls to redis. First one fetches the number of keys stored in redis (DBSize) Second one will fetch memory info that will be parsed to fetch the used_memory NOTE : we can only fetch database size, not cache size
()
| 57 | // Second one will fetch memory info that will be parsed to fetch the used_memory |
| 58 | // NOTE : we can only fetch database size, not cache size |
| 59 | func (r *redisCache) Stats() Stats { |
| 60 | return Stats{ |
| 61 | Items: r.nbOfKeys(), |
| 62 | Size: r.nbOfBytes(), |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | func (r *redisCache) nbOfKeys() uint64 { |
| 67 | ctx, cancelFunc := context.WithTimeout(context.Background(), statsTimeout) |