Class: WechatClient::CacheStore::RedisStore

Inherits:
BaseStore
  • Object
show all
Defined in:
lib/wechat_client/cache_store/redis_store.rb

Instance Method Summary collapse

Methods inherited from BaseStore

#initialize, #read, #write

Constructor Details

This class inherits a constructor from WechatClient::CacheStore::BaseStore

Instance Method Details

#cache_read(key) ⇒ Object



21
22
23
# File 'lib/wechat_client/cache_store/redis_store.rb', line 21

def cache_read key
  @client.get(key)
end

#cache_write(key, mar) ⇒ Object



14
15
16
17
18
19
# File 'lib/wechat_client/cache_store/redis_store.rb', line 14

def cache_write key, mar
  @client.multi do
    @client.set(key, mar)
    @client.expire(key, 60*60)
  end
end

#delete(key) ⇒ Object



10
11
12
# File 'lib/wechat_client/cache_store/redis_store.rb', line 10

def delete key
  @client.del(key)
end

#exists(key) ⇒ Object



6
7
8
# File 'lib/wechat_client/cache_store/redis_store.rb', line 6

def exists key
  @client.exists(key)
end