redis_page 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0ebb62533bb39ade8c23cce9eafdb0460cc9833
4
- data.tar.gz: 2ebc37364789d21567587806bd4e4de9d4d4ff9f
3
+ metadata.gz: e9ca66667234a903a05057773248de3b1ee5f128
4
+ data.tar.gz: 8ff48f330a31c95ce35d571c2df37d48a5529834
5
5
  SHA512:
6
- metadata.gz: 2566fb7284180a2262af4fcc7da6d1a90b617fb042463670852161d1997127bc80f5da06d404f1982dc8337348c186926f79a0d356e36c437d35545d749d33a6
7
- data.tar.gz: 1c23943ea1004a0236ed237514be522636affa1310d6b1cbf960945d729c246c25e81e09eaa010fb58f6ac4f6f6691c5ae1c2c28cf2fdec47d910fb904cc3c41
6
+ metadata.gz: 22acf5fc3ef696315e4730f316e95580379589ede369edc48d065a02cfa13b45f48d6e2fa95d72e0eafd8e30a045730056a2c2e91243d1b2b9b9ba91b36a4bfb
7
+ data.tar.gz: a8b817f6fc436d0386386a6361de1091c5465bcce2a785c93617834680a3b14a0a3d9c92c2b934706324c24c12b70fb1288b0d3211cf7b373e679d10de4a8727
data/README.md CHANGED
@@ -31,6 +31,7 @@ RedisPage.configure do |config|
31
31
  # 通过访问 http://cache:ewHN84JZLyRurX@example.com:8081/products/1 来刷新缓存
32
32
  config.sweeper = { port: 8081, username: 'cache', password: 'ewHN84JZLyRurX' }
33
33
  config.redis = Redis.new(host: "redis", port: 6379, db: 10)
34
+ config.ttl = 604800 # 缓存 1 周后(默认)过期
34
35
  end
35
36
 
36
37
  Sidekiq.configure_server do |config|
@@ -34,7 +34,7 @@ module ActionController
34
34
 
35
35
  def cache_redis_page(content, path)
36
36
  Rails.logger.info "[page cache]caching: #{path}"
37
- RedisPage.redis.set(path, content)
37
+ RedisPage.redis.setex(path, RedisPage.config.ttl || 604800, content) # 1 周后失效
38
38
  end
39
39
 
40
40
  def record_cached_page
@@ -1,3 +1,3 @@
1
1
  module RedisPage
2
- VERSION = "0.1.9"
2
+ VERSION = "0.1.10"
3
3
  end
data/lib/redis_page.rb CHANGED
@@ -2,7 +2,7 @@ require 'redis_page/railtie'
2
2
 
3
3
  module RedisPage
4
4
  class Config
5
- attr_accessor :sweeper, :redis
5
+ attr_accessor :sweeper, :redis, :ttl
6
6
  end
7
7
 
8
8
  def self.config
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - saberma