redis-rack-cache 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -4
- data/.travis.yml +14 -0
- data/Gemfile +3 -1
- data/README.md +32 -18
- data/Rakefile +2 -5
- data/lib/rack/cache/redis_entitystore.rb +3 -5
- data/lib/rack/cache/redis_metastore.rb +4 -2
- data/lib/redis-rack-cache/constants.rb +7 -0
- data/lib/redis-rack-cache/version.rb +1 -1
- data/redis-rack-cache.gemspec +10 -8
- data/test/rack/cache/metastore/redis_test.rb +8 -1
- metadata +36 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3caa665e3dee89bd21a7085aea42e75b4d3cad6
|
4
|
+
data.tar.gz: 5897df28cb8746aa90ab45263a27bd600881a724
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c0e010d1f2e16f01a2d879ffd7ad825d683cdcfccdea568d98f86a8e316a7200d66f70b460228f297bc8a4d15e99eeb1a611f0efd0cb1ea46b7697a919933d1
|
7
|
+
data.tar.gz: 924de8a2b5e29fb57dfd5fb404b4c55d284f77968d4e6d0a43dfd2f8634d02224bdbd8abf27cf12bf67a97981e17a6cc9930a42c1dc6327357f36df7d8c121b4
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,35 +1,49 @@
|
|
1
1
|
# Redis stores for Rack::Cache
|
2
2
|
|
3
|
-
|
3
|
+
## New maintainer required
|
4
|
+
|
5
|
+
**I am currently looking for a new maintainer for this gem. I am no longer doing any more work on this myself. Please contact me@ryanbigg.com if you'd like to take over this project.**
|
6
|
+
|
7
|
+
__`redis-rack-cache`__ provides a Redis backed store for __Rack::Cache__, an HTTP cache. See the main [redis-store readme](https://github.com/redis-store/redis-store) for general guidelines.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
7
|
-
|
8
|
-
|
11
|
+
```ruby
|
12
|
+
# Gemfile
|
13
|
+
gem 'redis-rack-cache'
|
14
|
+
```
|
9
15
|
|
10
|
-
|
16
|
+
## Usage
|
11
17
|
|
12
|
-
If you are using redis-store with Rails, consider using the [redis-rails gem](https://github.com/
|
18
|
+
If you are using redis-store with Rails, consider using the [redis-rails gem](https://github.com/redis-store/redis-rails) instead. For standalone usage:
|
13
19
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
20
|
+
```ruby
|
21
|
+
# config.ru
|
22
|
+
require 'rack'
|
23
|
+
require 'rack/cache'
|
24
|
+
require 'redis-rack-cache'
|
18
25
|
|
19
|
-
|
20
|
-
|
21
|
-
|
26
|
+
use Rack::Cache,
|
27
|
+
metastore: 'redis://localhost:6379/0/metastore',
|
28
|
+
entitystore: 'redis://localhost:6380/0/entitystore'
|
29
|
+
```
|
22
30
|
|
23
31
|
## Running tests
|
24
32
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
33
|
+
```shell
|
34
|
+
gem install bundler
|
35
|
+
git clone git://github.com/redis-store/redis-rack-cache.git
|
36
|
+
cd redis-rack-cache
|
37
|
+
bundle install
|
38
|
+
bundle exec rake
|
39
|
+
```
|
30
40
|
|
31
41
|
If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bundle exec rake`
|
32
42
|
|
43
|
+
## Status
|
44
|
+
|
45
|
+
[![Gem Version](https://badge.fury.io/rb/redis-rack-cache.png)](http://badge.fury.io/rb/redis-rack-cache) [![Build Status](https://secure.travis-ci.org/redis-store/redis-rack-cache.png?branch=master)](http://travis-ci.org/jodosha/redis-rack-cache?branch=master) [![Code Climate](https://codeclimate.com/github/jodosha/redis-store.png)](https://codeclimate.com/github/redis-store/redis-rack-cache)
|
46
|
+
|
33
47
|
## Copyright
|
34
48
|
|
35
|
-
|
49
|
+
2009 - 2013 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license
|
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rack/cache/entitystore'
|
2
|
+
require 'redis-rack-cache/constants'
|
2
3
|
|
3
4
|
module Rack
|
4
5
|
module Cache
|
@@ -36,11 +37,8 @@ module Rack
|
|
36
37
|
buf = StringIO.new
|
37
38
|
key, size = slurp(body){|part| buf.write(part) }
|
38
39
|
|
39
|
-
if ttl.zero?
|
40
|
-
|
41
|
-
else
|
42
|
-
[key, size] if cache.setex(key, ttl, buf.string)
|
43
|
-
end
|
40
|
+
ttl = ::Redis::Rack::Cache::DEFAULT_TTL if ttl.zero?
|
41
|
+
[key, size] if cache.setex(key, ttl, buf.string)
|
44
42
|
end
|
45
43
|
|
46
44
|
def purge(key)
|
@@ -2,6 +2,7 @@ require 'digest/sha1'
|
|
2
2
|
require 'rack/utils'
|
3
3
|
require 'rack/cache/key'
|
4
4
|
require 'rack/cache/metastore'
|
5
|
+
require 'redis-rack-cache/constants'
|
5
6
|
|
6
7
|
module Rack
|
7
8
|
module Cache
|
@@ -29,8 +30,9 @@ module Rack
|
|
29
30
|
cache.get(hexdigest(key)) || []
|
30
31
|
end
|
31
32
|
|
32
|
-
def write(key, entries)
|
33
|
-
|
33
|
+
def write(key, entries, ttl=0)
|
34
|
+
ttl = ::Redis::Rack::Cache::DEFAULT_TTL if ttl.zero?
|
35
|
+
cache.setex(hexdigest(key), ttl, entries)
|
34
36
|
end
|
35
37
|
|
36
38
|
def purge(key)
|
data/redis-rack-cache.gemspec
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path(
|
3
|
-
require
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'redis-rack-cache/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
6
|
+
s.name = 'redis-rack-cache'
|
7
7
|
s.version = Redis::Rack::Cache::VERSION
|
8
|
-
s.authors = [
|
9
|
-
s.email = [
|
10
|
-
s.homepage =
|
8
|
+
s.authors = ['Luca Guidi']
|
9
|
+
s.email = ['me@lucaguidi.com']
|
10
|
+
s.homepage = 'http://redis-store.org/redis-rack-cache'
|
11
11
|
s.summary = %q{Redis for Rack::Cache}
|
12
12
|
s.description = %q{Redis for Rack::Cache}
|
13
|
+
s.license = 'MIT'
|
13
14
|
|
14
|
-
s.rubyforge_project =
|
15
|
+
s.rubyforge_project = 'redis-rack-cache'
|
15
16
|
|
16
17
|
s.files = `git ls-files`.split("\n")
|
17
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = [
|
20
|
+
s.require_paths = ['lib']
|
20
21
|
|
21
22
|
s.add_dependency 'redis-store', '~> 1.1.0'
|
22
23
|
s.add_dependency 'rack-cache', '~> 1.2'
|
@@ -25,4 +26,5 @@ Gem::Specification.new do |s|
|
|
25
26
|
s.add_development_dependency 'bundler', '~> 1.3'
|
26
27
|
s.add_development_dependency 'mocha', '~> 0.14.0'
|
27
28
|
s.add_development_dependency 'minitest', '~> 5'
|
29
|
+
s.add_development_dependency 'redis-store-testing'
|
28
30
|
end
|
@@ -113,6 +113,13 @@ describe Rack::Cache::MetaStore::Redis do
|
|
113
113
|
store_simple_entry('/bad', { 'SOME_THING' => Proc.new {} })
|
114
114
|
end
|
115
115
|
|
116
|
+
it 'takes a ttl parameter for #write' do
|
117
|
+
@store.write('/foo', [[{},{}]], 123)
|
118
|
+
data = @store.read('/foo')
|
119
|
+
data.must_equal([[{},{}]])
|
120
|
+
end
|
121
|
+
|
122
|
+
|
116
123
|
# Abstract methods ===========================================================
|
117
124
|
|
118
125
|
it 'stores a cache entry' do
|
@@ -266,4 +273,4 @@ describe Rack::Cache::MetaStore::Redis do
|
|
266
273
|
define_method :uri do |uri|
|
267
274
|
URI.parse uri
|
268
275
|
end
|
269
|
-
end
|
276
|
+
end
|
metadata
CHANGED
@@ -1,99 +1,113 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-rack-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-store
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rack-cache
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.3'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mocha
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.14.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.14.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: minitest
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '5'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '5'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: redis-store-testing
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Redis for Rack::Cache
|
98
112
|
email:
|
99
113
|
- me@lucaguidi.com
|
@@ -101,7 +115,8 @@ executables: []
|
|
101
115
|
extensions: []
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
104
|
-
- .gitignore
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
105
120
|
- Gemfile
|
106
121
|
- MIT-LICENSE
|
107
122
|
- README.md
|
@@ -109,6 +124,7 @@ files:
|
|
109
124
|
- lib/rack/cache/redis_entitystore.rb
|
110
125
|
- lib/rack/cache/redis_metastore.rb
|
111
126
|
- lib/redis-rack-cache.rb
|
127
|
+
- lib/redis-rack-cache/constants.rb
|
112
128
|
- lib/redis-rack-cache/version.rb
|
113
129
|
- redis-rack-cache.gemspec
|
114
130
|
- test/rack/cache/entitystore/pony.jpg
|
@@ -117,7 +133,8 @@ files:
|
|
117
133
|
- test/redis-rack-cache/version_test.rb
|
118
134
|
- test/test_helper.rb
|
119
135
|
homepage: http://redis-store.org/redis-rack-cache
|
120
|
-
licenses:
|
136
|
+
licenses:
|
137
|
+
- MIT
|
121
138
|
metadata: {}
|
122
139
|
post_install_message:
|
123
140
|
rdoc_options: []
|
@@ -125,17 +142,17 @@ require_paths:
|
|
125
142
|
- lib
|
126
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
127
144
|
requirements:
|
128
|
-
- -
|
145
|
+
- - ">="
|
129
146
|
- !ruby/object:Gem::Version
|
130
147
|
version: '0'
|
131
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
149
|
requirements:
|
133
|
-
- -
|
150
|
+
- - ">="
|
134
151
|
- !ruby/object:Gem::Version
|
135
152
|
version: '0'
|
136
153
|
requirements: []
|
137
154
|
rubyforge_project: redis-rack-cache
|
138
|
-
rubygems_version: 2.
|
155
|
+
rubygems_version: 2.4.5
|
139
156
|
signing_key:
|
140
157
|
specification_version: 4
|
141
158
|
summary: Redis for Rack::Cache
|