supercache 0.4 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -0
- data/README.md +1 -3
- data/lib/supercache/super_http_cache.rb +1 -1
- data/lib/supercache/super_query_cache.rb +31 -9
- data/lib/supercache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33d861e49df9f206bbcfdef96f864d574828f142
|
4
|
+
data.tar.gz: 74c44314df7dc774bb84356e7ef20a44482afb86
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e614c33ee5ac71d062eeb646fb9ec759a575ee6d9c006a973a5574431c69b59eb9a80187f666fc1cf27ee3da186b5e1e9b964d943e060c5229836c102b6c2caf
|
7
|
+
data.tar.gz: 0be7e7e352c5708129053719eb1354c417d9514377837c9687adf4b4dad2022124e19b7d3681cb2f64ff38924b19288f274f936c81bcf53e32db8e53d57ebaf5
|
data/.travis.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- 1.9.3
|
3
4
|
- 2.2.5
|
4
5
|
- 2.3.1
|
5
6
|
- ruby-head
|
@@ -11,3 +12,12 @@ gemfile:
|
|
11
12
|
- gemfiles/rails_4.1.gemfile
|
12
13
|
- gemfiles/rails_4.2.gemfile
|
13
14
|
- gemfiles/rails_5.0.gemfile
|
15
|
+
|
16
|
+
matrix:
|
17
|
+
exclude:
|
18
|
+
- rvm: 1.9.3
|
19
|
+
gemfile: gemfiles/rails_4.1.gemfile
|
20
|
+
- rvm: 1.9.3
|
21
|
+
gemfile: gemfiles/rails_4.2.gemfile
|
22
|
+
- rvm: 1.9.3
|
23
|
+
gemfile: gemfiles/rails_5.0.gemfile
|
data/README.md
CHANGED
@@ -48,6 +48,4 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
48
48
|
## Scope for Contribution
|
49
49
|
|
50
50
|
1. RSpec Integration
|
51
|
-
2. Add
|
52
|
-
3. Add RSolr Cache
|
53
|
-
4. Add Exceptions to Caching
|
51
|
+
2. Add Exceptions to Caching
|
@@ -2,7 +2,7 @@ module Net
|
|
2
2
|
class HTTP
|
3
3
|
def request_with_superhttpcache(*args, &block)
|
4
4
|
if Rails.cache.read(:http_supercache)
|
5
|
-
Rails.cache.fetch(args[0].path.to_s
|
5
|
+
Rails.cache.fetch(Digest::SHA1.hexdigest(args[0].path.to_s + args[0].body.to_s)) do
|
6
6
|
request_without_superhttpcache(*args, &block)
|
7
7
|
end
|
8
8
|
else
|
@@ -1,13 +1,35 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
1
|
+
if RUBY_VERSION < "2.0"
|
2
|
+
module ActiveRecord
|
3
|
+
module ConnectionAdapters # :nodoc:
|
4
|
+
module QueryCache
|
5
|
+
def cache_sql_with_superquerycache(*args, &block)
|
6
|
+
if Rails.cache.read(:ar_supercache)
|
7
|
+
Rails.cache.fetch(Digest::SHA1.hexdigest("supercache_#{args[0]}_#{args[1]}")) do
|
8
|
+
request_without_superquerycache(*args, &block)
|
9
|
+
end
|
10
|
+
else
|
11
|
+
request_without_superquerycache(*args, &block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
alias_method :request_without_superquerycache, :cache_sql
|
16
|
+
alias_method :cache_sql, :cache_sql_with_superquerycache
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
else
|
22
|
+
module SuperQueryCache
|
23
|
+
def cache_sql(*args, &block)
|
24
|
+
if Rails.cache.read(:ar_supercache)
|
25
|
+
Rails.cache.fetch(Digest::SHA1.hexdigest("supercache_#{args[0]}_#{args[1]}")) do
|
26
|
+
super(*args, &block)
|
27
|
+
end
|
28
|
+
else
|
29
|
+
super(*args, &block)
|
6
30
|
end
|
7
|
-
else
|
8
|
-
super(sql, binds)
|
9
31
|
end
|
10
32
|
end
|
11
|
-
end
|
12
33
|
|
13
|
-
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(SuperQueryCache)
|
34
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend(SuperQueryCache)
|
35
|
+
end
|
data/lib/supercache/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: supercache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bragadeesh J
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|