cashier 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/..gemspec +21 -0
- data/.gitignore +42 -0
- data/.infinity_test +19 -0
- data/Gemfile +2 -14
- data/Gemfile.lock +107 -22
- data/Rakefile +1 -37
- data/cashier.gemspec +22 -62
- data/lib/cashier.rb +47 -46
- data/lib/cashier/controller_helper.rb +2 -6
- data/lib/cashier/cucumber.rb +6 -0
- data/lib/cashier/matchers.rb +39 -0
- data/lib/cashier/railtie.rb +8 -0
- data/lib/cashier/version.rb +3 -0
- data/readme.md +40 -25
- data/spec/application_controller_spec.rb +31 -0
- data/spec/cashier_spec.rb +84 -2
- data/spec/spec_helper.rb +6 -0
- data/spec/test_app/.gitignore +4 -0
- data/spec/test_app/Gemfile +31 -0
- data/spec/test_app/Gemfile.lock +73 -0
- data/spec/test_app/README +256 -0
- data/spec/test_app/Rakefile +7 -0
- data/spec/test_app/app/controllers/application_controller.rb +3 -0
- data/spec/test_app/app/controllers/home_controller.rb +7 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/helpers/home_helper.rb +2 -0
- data/spec/test_app/app/views/home/index.html.erb +1 -0
- data/spec/test_app/app/views/layouts/application.html.erb +14 -0
- data/spec/test_app/config.ru +4 -0
- data/spec/test_app/config/application.rb +48 -0
- data/spec/test_app/config/boot.rb +10 -0
- data/spec/test_app/config/database.yml +22 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +28 -0
- data/spec/test_app/config/environments/production.rb +49 -0
- data/spec/test_app/config/environments/test.rb +36 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/test_app/config/initializers/inflections.rb +10 -0
- data/spec/test_app/config/initializers/mime_types.rb +5 -0
- data/spec/test_app/config/initializers/secret_token.rb +7 -0
- data/spec/test_app/config/initializers/session_store.rb +8 -0
- data/spec/test_app/config/locales/en.yml +5 -0
- data/spec/test_app/config/routes.rb +60 -0
- data/spec/test_app/db/seeds.rb +7 -0
- data/spec/test_app/lib/tasks/.gitkeep +0 -0
- data/spec/test_app/public/404.html +26 -0
- data/spec/test_app/public/422.html +26 -0
- data/spec/test_app/public/500.html +26 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/public/images/rails.png +0 -0
- data/spec/test_app/public/javascripts/application.js +2 -0
- data/spec/test_app/public/javascripts/controls.js +965 -0
- data/spec/test_app/public/javascripts/dragdrop.js +974 -0
- data/spec/test_app/public/javascripts/effects.js +1123 -0
- data/spec/test_app/public/javascripts/prototype.js +6001 -0
- data/spec/test_app/public/javascripts/rails.js +191 -0
- data/spec/test_app/public/robots.txt +5 -0
- data/spec/test_app/public/stylesheets/.gitkeep +0 -0
- data/spec/test_app/script/rails +6 -0
- data/spec/test_app/test/performance/browsing_test.rb +9 -0
- data/spec/test_app/test/test_helper.rb +13 -0
- data/spec/test_app/vendor/plugins/.gitkeep +0 -0
- metadata +144 -39
- data/VERSION +0 -1
data/..gemspec
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "./version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "."
|
7
|
+
s.version = .::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["TODO: Write your name"]
|
10
|
+
s.email = ["TODO: Write your email address"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{TODO: Write a gem summary}
|
13
|
+
s.description = %q{TODO: Write a gem description}
|
14
|
+
|
15
|
+
s.rubyforge_project = "."
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
end
|
data/.gitignore
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# rcov generated
|
2
|
+
coverage
|
3
|
+
|
4
|
+
# rdoc generated
|
5
|
+
rdoc
|
6
|
+
|
7
|
+
# yard generated
|
8
|
+
doc
|
9
|
+
.yardoc
|
10
|
+
|
11
|
+
# bundler
|
12
|
+
.bundle
|
13
|
+
|
14
|
+
# jeweler generated
|
15
|
+
pkg
|
16
|
+
|
17
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
18
|
+
#
|
19
|
+
# * Create a file at ~/.gitignore
|
20
|
+
# * Include files you want ignored
|
21
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
22
|
+
#
|
23
|
+
# After doing this, these files will be ignored in all your git projects,
|
24
|
+
# saving you from having to 'pollute' every project you touch with them
|
25
|
+
#
|
26
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
27
|
+
#
|
28
|
+
# For MacOS:
|
29
|
+
#
|
30
|
+
.DS_Store
|
31
|
+
#
|
32
|
+
# For TextMate
|
33
|
+
#*.tmproj
|
34
|
+
#tmtags
|
35
|
+
#
|
36
|
+
# For emacs:
|
37
|
+
#*~
|
38
|
+
#\#*
|
39
|
+
#.\#*
|
40
|
+
#
|
41
|
+
# For vim:
|
42
|
+
*.swp
|
data/.infinity_test
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
infinity_test do
|
2
|
+
notifications :growl
|
3
|
+
|
4
|
+
use :test_framework => :rspec
|
5
|
+
|
6
|
+
before_run do
|
7
|
+
clear :terminal
|
8
|
+
end
|
9
|
+
|
10
|
+
heuristics do
|
11
|
+
add('lib/(.+)\.rb') do |file|
|
12
|
+
run :all => :tests
|
13
|
+
end
|
14
|
+
|
15
|
+
add('rails_app') do |file|
|
16
|
+
run :all => :tests
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/Gemfile
CHANGED
@@ -1,16 +1,4 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
2
|
|
6
|
-
gem
|
7
|
-
|
8
|
-
|
9
|
-
# Add dependencies to develop your gem here.
|
10
|
-
# Include everything needed to run rake, tests, features, etc.
|
11
|
-
group :development do
|
12
|
-
gem "rspec", "~> 2.3.0"
|
13
|
-
gem "bundler", "~> 1.0.0"
|
14
|
-
gem "jeweler", "~> 1.5.2"
|
15
|
-
gem "rcov", ">= 0"
|
16
|
-
end
|
3
|
+
# Specify your gem's dependencies in ..gemspec
|
4
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,33 +1,118 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cashier (0.2.0)
|
5
|
+
|
1
6
|
GEM
|
2
7
|
remote: http://rubygems.org/
|
3
8
|
specs:
|
9
|
+
abstract (1.0.0)
|
10
|
+
actionmailer (3.0.4)
|
11
|
+
actionpack (= 3.0.4)
|
12
|
+
mail (~> 2.2.15)
|
13
|
+
actionpack (3.0.4)
|
14
|
+
activemodel (= 3.0.4)
|
15
|
+
activesupport (= 3.0.4)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.4)
|
19
|
+
rack (~> 1.2.1)
|
20
|
+
rack-mount (~> 0.6.13)
|
21
|
+
rack-test (~> 0.5.7)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.4)
|
24
|
+
activesupport (= 3.0.4)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.4)
|
27
|
+
activerecord (3.0.4)
|
28
|
+
activemodel (= 3.0.4)
|
29
|
+
activesupport (= 3.0.4)
|
30
|
+
arel (~> 2.0.2)
|
31
|
+
tzinfo (~> 0.3.23)
|
32
|
+
activeresource (3.0.4)
|
33
|
+
activemodel (= 3.0.4)
|
34
|
+
activesupport (= 3.0.4)
|
35
|
+
activesupport (3.0.4)
|
36
|
+
archive-tar-minitar (0.5.2)
|
37
|
+
arel (2.0.8)
|
38
|
+
builder (2.1.2)
|
39
|
+
columnize (0.3.2)
|
4
40
|
diff-lcs (1.1.2)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
41
|
+
erubis (2.6.6)
|
42
|
+
abstract (>= 1.0.0)
|
43
|
+
i18n (0.5.0)
|
44
|
+
infinity_test (1.0.2)
|
45
|
+
notifiers (>= 1.1.0)
|
46
|
+
watchr (>= 0.7)
|
47
|
+
linecache19 (0.5.11)
|
48
|
+
ruby_core_source (>= 0.1.4)
|
49
|
+
mail (2.2.15)
|
50
|
+
activesupport (>= 2.3.6)
|
51
|
+
i18n (>= 0.4.0)
|
52
|
+
mime-types (~> 1.16)
|
53
|
+
treetop (~> 1.4.8)
|
54
|
+
memcache-client (1.8.5)
|
55
|
+
mime-types (1.16)
|
56
|
+
notifiers (1.1.0)
|
57
|
+
polyglot (0.3.1)
|
58
|
+
rack (1.2.1)
|
59
|
+
rack-mount (0.6.13)
|
60
|
+
rack (>= 1.0.0)
|
61
|
+
rack-test (0.5.7)
|
62
|
+
rack (>= 1.0)
|
63
|
+
rails (3.0.4)
|
64
|
+
actionmailer (= 3.0.4)
|
65
|
+
actionpack (= 3.0.4)
|
66
|
+
activerecord (= 3.0.4)
|
67
|
+
activeresource (= 3.0.4)
|
68
|
+
activesupport (= 3.0.4)
|
69
|
+
bundler (~> 1.0)
|
70
|
+
railties (= 3.0.4)
|
71
|
+
railties (3.0.4)
|
72
|
+
actionpack (= 3.0.4)
|
73
|
+
activesupport (= 3.0.4)
|
74
|
+
rake (>= 0.8.7)
|
75
|
+
thor (~> 0.14.4)
|
10
76
|
rake (0.8.7)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
rspec (2.
|
16
|
-
|
17
|
-
rspec-expectations (~> 2.3.0)
|
18
|
-
rspec-mocks (~> 2.3.0)
|
19
|
-
rspec-core (2.3.1)
|
20
|
-
rspec-expectations (2.3.0)
|
77
|
+
rspec (2.5.0)
|
78
|
+
rspec-core (~> 2.5.0)
|
79
|
+
rspec-expectations (~> 2.5.0)
|
80
|
+
rspec-mocks (~> 2.5.0)
|
81
|
+
rspec-core (2.5.1)
|
82
|
+
rspec-expectations (2.5.0)
|
21
83
|
diff-lcs (~> 1.1.2)
|
22
|
-
rspec-mocks (2.
|
84
|
+
rspec-mocks (2.5.0)
|
85
|
+
rspec-rails (2.5.0)
|
86
|
+
actionpack (~> 3.0)
|
87
|
+
activesupport (~> 3.0)
|
88
|
+
railties (~> 3.0)
|
89
|
+
rspec (~> 2.5.0)
|
90
|
+
ruby-debug-base19 (0.11.24)
|
91
|
+
columnize (>= 0.3.1)
|
92
|
+
linecache19 (>= 0.5.11)
|
93
|
+
ruby_core_source (>= 0.1.4)
|
94
|
+
ruby-debug19 (0.11.6)
|
95
|
+
columnize (>= 0.3.1)
|
96
|
+
linecache19 (>= 0.5.11)
|
97
|
+
ruby-debug-base19 (>= 0.11.19)
|
98
|
+
ruby_core_source (0.1.4)
|
99
|
+
archive-tar-minitar (>= 0.5.2)
|
100
|
+
sqlite3 (1.3.3)
|
101
|
+
thor (0.14.6)
|
102
|
+
treetop (1.4.9)
|
103
|
+
polyglot (>= 0.3.1)
|
104
|
+
tzinfo (0.3.24)
|
105
|
+
watchr (0.7)
|
23
106
|
|
24
107
|
PLATFORMS
|
25
108
|
ruby
|
26
109
|
|
27
110
|
DEPENDENCIES
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
rspec
|
111
|
+
cashier!
|
112
|
+
infinity_test
|
113
|
+
memcache-client
|
114
|
+
rails
|
115
|
+
rspec
|
116
|
+
rspec-rails
|
117
|
+
ruby-debug19
|
118
|
+
sqlite3
|
data/Rakefile
CHANGED
@@ -1,31 +1,5 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'bundler'
|
3
|
-
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name = "cashier"
|
16
|
-
gem.homepage = "http://github.com/Adman65/cashier"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{Tag based caching for Rails}
|
19
|
-
gem.description = %Q{Associate different cached content with a tag, then expire by tag instead of key}
|
20
|
-
gem.email = "Adman1965@gmail.com"
|
21
|
-
gem.authors = ["Adam Hawkins"]
|
22
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
# gem.add_runtime_dependency 'redis'
|
25
|
-
# gem.add_runtime_dependency 'redis-namespace'
|
26
|
-
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
27
|
-
end
|
28
|
-
Jeweler::RubygemsDotOrgTasks.new
|
2
|
+
Bundler::GemHelper.install_tasks
|
29
3
|
|
30
4
|
require 'rspec/core'
|
31
5
|
require 'rspec/core/rake_task'
|
@@ -39,13 +13,3 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
39
13
|
end
|
40
14
|
|
41
15
|
task :default => :spec
|
42
|
-
|
43
|
-
require 'rake/rdoctask'
|
44
|
-
Rake::RDocTask.new do |rdoc|
|
45
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
-
|
47
|
-
rdoc.rdoc_dir = 'rdoc'
|
48
|
-
rdoc.title = "cashier #{version}"
|
49
|
-
rdoc.rdoc_files.include('README*')
|
50
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
-
end
|
data/cashier.gemspec
CHANGED
@@ -1,70 +1,30 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "cashier/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
9
|
-
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
6
|
+
s.name = "cashier"
|
7
|
+
s.version = Cashier::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Adam Hawkins"]
|
10
|
+
s.email = ["adman1965@gmail.com"]
|
11
|
+
s.homepage = "https://github.com/Adman65/cashier"
|
12
|
+
s.summary = %q{Tag based caching for Rails}
|
13
13
|
s.description = %q{Associate different cached content with a tag, then expire by tag instead of key}
|
14
|
-
s.email = %q{Adman1965@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
".rvmrc",
|
20
|
-
"Gemfile",
|
21
|
-
"Gemfile.lock",
|
22
|
-
"LICENSE.txt",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION",
|
25
|
-
"cashier.gemspec",
|
26
|
-
"lib/cashier.rb",
|
27
|
-
"lib/cashier/controller_helper.rb",
|
28
|
-
"readme.md",
|
29
|
-
"spec/cashier_spec.rb",
|
30
|
-
"spec/spec_helper.rb"
|
31
|
-
]
|
32
|
-
s.homepage = %q{http://github.com/Adman65/cashier}
|
33
|
-
s.licenses = ["MIT"]
|
34
|
-
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.7}
|
36
|
-
s.summary = %q{Tag based caching for Rails}
|
37
|
-
s.test_files = [
|
38
|
-
"spec/cashier_spec.rb",
|
39
|
-
"spec/spec_helper.rb"
|
40
|
-
]
|
41
14
|
|
42
|
-
|
43
|
-
|
44
|
-
|
15
|
+
s.rubyforge_project = "cashier"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
45
21
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
else
|
54
|
-
s.add_dependency(%q<redis>, [">= 0"])
|
55
|
-
s.add_dependency(%q<redis-namespace>, [">= 0"])
|
56
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
57
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
59
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
60
|
-
end
|
61
|
-
else
|
62
|
-
s.add_dependency(%q<redis>, [">= 0"])
|
63
|
-
s.add_dependency(%q<redis-namespace>, [">= 0"])
|
64
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
65
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
66
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
67
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
68
|
-
end
|
22
|
+
s.add_development_dependency 'rails'
|
23
|
+
s.add_development_dependency 'rspec'
|
24
|
+
s.add_development_dependency 'rspec-rails'
|
25
|
+
s.add_development_dependency 'infinity_test'
|
26
|
+
s.add_development_dependency 'memcache-client'
|
27
|
+
s.add_development_dependency 'ruby-debug19'
|
28
|
+
s.add_development_dependency 'sqlite3'
|
69
29
|
end
|
70
30
|
|
data/lib/cashier.rb
CHANGED
@@ -3,75 +3,76 @@
|
|
3
3
|
module Cashier
|
4
4
|
extend self
|
5
5
|
|
6
|
-
|
7
|
-
STORAGE_KEY = 'cashier-tags'
|
6
|
+
CACHE_KEY = 'cashier-tags'
|
8
7
|
|
9
8
|
def perform_caching?
|
10
9
|
::ApplicationController.perform_caching
|
11
10
|
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# Accepts:
|
17
|
-
# 1. A 'hostname:port' string
|
18
|
-
# 2. A 'hostname:port:db' string (to select the Redis db)
|
19
|
-
# 3. A 'hostname:port/namespace' string (to set the Redis namespace)
|
20
|
-
# 4. A redis URL string 'redis://host:port'
|
21
|
-
# 5. An instance of `Redis`, `Redis::Client`, `Redis::DistRedis`,
|
22
|
-
# or `Redis::Namespace`.
|
23
|
-
def redis=(server)
|
24
|
-
if server.respond_to? :split
|
25
|
-
if server =~ /redis\:\/\//
|
26
|
-
redis = Redis.connect(:url => server)
|
27
|
-
else
|
28
|
-
server, namespace = server.split('/', 2)
|
29
|
-
host, port, db = server.split(':')
|
30
|
-
redis = Redis.new(:host => host, :port => port,
|
31
|
-
:thread_safe => true, :db => db)
|
32
|
-
end
|
33
|
-
namespace ||= :cashier
|
12
|
+
def store_fragment(fragment, *tags)
|
13
|
+
return unless perform_caching?
|
34
14
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
@redis = Redis::Namespace.new(:cashier, :redis => server)
|
15
|
+
tags.each do |tag|
|
16
|
+
# store the fragment
|
17
|
+
fragments = Rails.cache.fetch(tag) || []
|
18
|
+
Rails.cache.write(tag, fragments + [fragment])
|
40
19
|
end
|
41
|
-
end
|
42
20
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
self.redis = 'localhost:6379'
|
48
|
-
self.redis
|
21
|
+
# now store the tag for book keeping
|
22
|
+
cashier_tags = Rails.cache.fetch(CACHE_KEY) || []
|
23
|
+
cashier_tags = (cashier_tags + tags).uniq
|
24
|
+
Rails.cache.write(CACHE_KEY, cashier_tags)
|
49
25
|
end
|
50
26
|
|
51
27
|
def expire(*tags)
|
52
28
|
return unless perform_caching?
|
53
29
|
|
30
|
+
# delete them from the cache
|
54
31
|
tags.each do |tag|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
if members.is_a?(Array)
|
59
|
-
members.each do |cache_key|
|
60
|
-
Rails.cache.delete(cache_key)
|
32
|
+
if fragment_keys = Rails.cache.fetch(tag)
|
33
|
+
fragment_keys.each do |fragment_key|
|
34
|
+
Rails.cache.delete(fragment_key)
|
61
35
|
end
|
62
|
-
redis.del(tag)
|
63
|
-
redis.srem(STORAGE_KEY, tag)
|
64
36
|
end
|
37
|
+
Rails.cache.delete(tag)
|
65
38
|
end
|
39
|
+
|
40
|
+
# now remove them from the list
|
41
|
+
# of stored tags
|
42
|
+
cashier_tags = Rails.cache.fetch(CACHE_KEY) || []
|
43
|
+
cashier_tags = (cashier_tags - tags).uniq
|
44
|
+
Rails.cache.write(CACHE_KEY, cashier_tags)
|
66
45
|
end
|
67
46
|
|
68
47
|
def tags
|
69
|
-
|
48
|
+
Rails.cache.fetch(CACHE_KEY) || []
|
70
49
|
end
|
71
50
|
|
72
|
-
def
|
51
|
+
def clear
|
73
52
|
expire(*tags)
|
53
|
+
Rails.cache.delete(CACHE_KEY)
|
74
54
|
end
|
75
|
-
|
55
|
+
|
56
|
+
def wipe
|
57
|
+
clear
|
58
|
+
end
|
59
|
+
|
60
|
+
def keys
|
61
|
+
tags.inject([]) do |arry, tag|
|
62
|
+
arry += Rails.cache.fetch(tag)
|
63
|
+
end.compact
|
64
|
+
end
|
65
|
+
|
66
|
+
def keys_for(tag)
|
67
|
+
Rails.cache.fetch(tag) || []
|
68
|
+
end
|
69
|
+
end
|
76
70
|
|
77
71
|
require 'cashier/controller_helper'
|
72
|
+
require 'cashier/matchers'
|
73
|
+
|
74
|
+
if defined?(::Rails)
|
75
|
+
if Rails::VERSION::MAJOR == 3
|
76
|
+
require 'cashier/railtie'
|
77
|
+
end
|
78
|
+
end
|