Set cache to runtime. ttl is second, if ttl is 0, it will be forever till restart.
(key string, value interface{}, ttl int64)
| 106 | // Set cache to runtime. |
| 107 | // ttl is second, if ttl is 0, it will be forever till restart. |
| 108 | func (ca *RuntimeCache) Set(key string, value interface{}, ttl int64) error { |
| 109 | ca.initValue(key, value, ttl) |
| 110 | return nil |
| 111 | } |
| 112 | |
| 113 | func (ca *RuntimeCache) initValue(key string, value interface{}, ttl int64) error { |
| 114 | ca.items.Store(key, &RuntimeItem{ |