Class: ShopifyClient::Cache::RedisStore
- Inherits:
-
Store
- Object
- Store
- ShopifyClient::Cache::RedisStore
show all
- Defined in:
- lib/shopify-client/cache/redis_store.rb
Instance Method Summary
collapse
Methods inherited from Store
#call, #initialize
Instance Method Details
#clear(key) ⇒ Object
23
24
25
|
# File 'lib/shopify-client/cache/redis_store.rb', line 23
def clear(key)
Redis.current.del(key)
end
|
#get(key) ⇒ Object
7
8
9
10
11
|
# File 'lib/shopify-client/cache/redis_store.rb', line 7
def get(key)
value = Redis.current.get(key)
@decode.(value) unless value.nil?
end
|
#set(key, value, ttl: ShopifyClient.config.cache_ttl) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/shopify-client/cache/redis_store.rb', line 14
def set(key, value, ttl: ShopifyClient.config.cache_ttl)
Redis.current.set(key, @encode.(value))
if ttl > 0
Redis.current.expire(key, ttl)
end
end
|