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 +4 -4
- data/README.md +1 -0
- data/lib/action_controller/caching/redis_pages.rb +1 -1
- data/lib/redis_page/version.rb +1 -1
- data/lib/redis_page.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9ca66667234a903a05057773248de3b1ee5f128
|
4
|
+
data.tar.gz: 8ff48f330a31c95ce35d571c2df37d48a5529834
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
37
|
+
RedisPage.redis.setex(path, RedisPage.config.ttl || 604800, content) # 1 周后失效
|
38
38
|
end
|
39
39
|
|
40
40
|
def record_cached_page
|
data/lib/redis_page/version.rb
CHANGED
data/lib/redis_page.rb
CHANGED