find_cache 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/{CHANGE-LOG → CHANGE_LOG.rdoc} +18 -13
- data/Gemfile +4 -0
- data/README.rdoc +5 -47
- data/Rakefile +4 -36
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/find_cache.gemspec +29 -0
- data/lib/find_cache.rb +6 -1
- data/lib/find_cache/cacheable.rb +37 -12
- data/lib/find_cache/controller_garbage_collector.rb +17 -0
- data/lib/find_cache/counter_cache.rb +14 -0
- data/lib/find_cache/key_gen.rb +10 -6
- data/lib/find_cache/version.rb +1 -1
- metadata +93 -328
- data/MIT-LICENSE +0 -22
- data/lib/tasks/find_cache_tasks.rake +0 -4
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -15
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/models/comment.rb +0 -6
- data/test/dummy/app/models/post.rb +0 -7
- data/test/dummy/app/models/user.rb +0 -13
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -39
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -40
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/counter_cache_patch.rb +0 -19
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20120824210455_create_users.rb +0 -10
- data/test/dummy/db/migrate/20120824210731_create_comments.rb +0 -11
- data/test/dummy/db/migrate/20120824210927_create_posts.rb +0 -13
- data/test/dummy/db/schema.rb +0 -43
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +0 -1793
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/test/fixtures/comments.yml +0 -9
- data/test/dummy/test/fixtures/posts.yml +0 -13
- data/test/dummy/test/fixtures/users.yml +0 -9
- data/test/dummy/test/unit/comment_test.rb +0 -7
- data/test/dummy/test/unit/post_test.rb +0 -7
- data/test/dummy/test/unit/user_test.rb +0 -7
- data/test/dummy/tmp/cache/26E/540/User%2F1 +0 -0
- data/test/dummy/tmp/cache/26F/550/User%2F2 +0 -0
- data/test/dummy/tmp/cache/270/560/User%2F3 +0 -0
- data/test/dummy/tmp/cache/271/570/User%2F4 +0 -0
- data/test/dummy/tmp/cache/272/580/User%2F5 +0 -0
- data/test/dummy/tmp/cache/273/590/User%2F6 +0 -0
- data/test/dummy/tmp/cache/274/5A0/User%2F7 +0 -0
- data/test/dummy/tmp/cache/275/5B0/User%2F8 +0 -0
- data/test/dummy/tmp/cache/275/6E0/Post%2F1 +0 -0
- data/test/dummy/tmp/cache/276/5C0/User%2F9 +0 -0
- data/test/dummy/tmp/cache/276/6F0/Post%2F2 +0 -0
- data/test/dummy/tmp/cache/277/700/Post%2F3 +0 -0
- data/test/dummy/tmp/cache/29E/F20/User%2F10 +0 -0
- data/test/dummy/tmp/cache/29F/F30/User%2F11 +0 -0
- data/test/dummy/tmp/cache/29F/F40/User%2F20 +0 -0
- data/test/dummy/tmp/cache/2A0/F40/User%2F12 +0 -0
- data/test/dummy/tmp/cache/2A1/F50/User%2F13 +0 -0
- data/test/dummy/tmp/cache/2A2/F60/User%2F14 +0 -0
- data/test/dummy/tmp/cache/2A3/F70/User%2F15 +0 -0
- data/test/dummy/tmp/cache/2A4/F80/User%2F16 +0 -0
- data/test/dummy/tmp/cache/2A5/F90/User%2F17 +0 -0
- data/test/dummy/tmp/cache/2A6/FA0/User%2F18 +0 -0
- data/test/dummy/tmp/cache/2A7/FB0/User%2F19 +0 -0
- data/test/dummy/tmp/cache/3A8/070/Comment%2F7 +0 -0
- data/test/dummy/tmp/cache/3A9/080/Comment%2F8 +0 -0
- data/test/dummy/tmp/cache/3AA/090/Comment%2F9 +0 -0
- data/test/dummy/tmp/cache/3D2/D30/Comment%2F10 +0 -0
- data/test/dummy/tmp/cache/3D3/D50/Comment%2F20 +0 -0
- data/test/dummy/tmp/cache/3D4/D50/Comment%2F12 +0 -0
- data/test/dummy/tmp/cache/3D4/D70/Comment%2F30 +0 -0
- data/test/dummy/tmp/cache/3D5/D60/Comment%2F13 +0 -0
- data/test/dummy/tmp/cache/3D5/D70/Comment%2F22 +0 -0
- data/test/dummy/tmp/cache/3D5/D90/Comment%2F40 +0 -0
- data/test/dummy/tmp/cache/3D6/D70/Comment%2F14 +0 -0
- data/test/dummy/tmp/cache/3D6/D80/Comment%2F23 +0 -0
- data/test/dummy/tmp/cache/3D6/D90/Comment%2F32 +0 -0
- data/test/dummy/tmp/cache/3D6/DB0/Comment%2F50 +0 -0
- data/test/dummy/tmp/cache/3D7/D80/Comment%2F15 +0 -0
- data/test/dummy/tmp/cache/3D7/D90/Comment%2F24 +0 -0
- data/test/dummy/tmp/cache/3D7/DA0/Comment%2F33 +0 -0
- data/test/dummy/tmp/cache/3D7/DB0/Comment%2F42 +0 -0
- data/test/dummy/tmp/cache/3D7/DD0/Comment%2F60 +0 -0
- data/test/dummy/tmp/cache/3D8/DA0/Comment%2F25 +0 -0
- data/test/dummy/tmp/cache/3D8/DB0/Comment%2F34 +0 -0
- data/test/dummy/tmp/cache/3D8/DC0/Comment%2F43 +0 -0
- data/test/dummy/tmp/cache/3D8/DD0/Comment%2F52 +0 -0
- data/test/dummy/tmp/cache/3D8/DF0/Comment%2F70 +0 -0
- data/test/dummy/tmp/cache/3D9/DA0/Comment%2F17 +0 -0
- data/test/dummy/tmp/cache/3D9/DC0/Comment%2F35 +0 -0
- data/test/dummy/tmp/cache/3D9/DD0/Comment%2F44 +0 -0
- data/test/dummy/tmp/cache/3D9/DE0/Comment%2F53 +0 -0
- data/test/dummy/tmp/cache/3D9/DF0/Comment%2F62 +0 -0
- data/test/dummy/tmp/cache/3D9/E10/Comment%2F80 +0 -0
- data/test/dummy/tmp/cache/3DA/DB0/Comment%2F18 +0 -0
- data/test/dummy/tmp/cache/3DA/DC0/Comment%2F27 +0 -0
- data/test/dummy/tmp/cache/3DA/DE0/Comment%2F45 +0 -0
- data/test/dummy/tmp/cache/3DA/DF0/Comment%2F54 +0 -0
- data/test/dummy/tmp/cache/3DA/E00/Comment%2F63 +0 -0
- data/test/dummy/tmp/cache/3DA/E10/Comment%2F72 +0 -0
- data/test/dummy/tmp/cache/3DB/DC0/Comment%2F19 +0 -0
- data/test/dummy/tmp/cache/3DB/DD0/Comment%2F28 +0 -0
- data/test/dummy/tmp/cache/3DB/DE0/Comment%2F37 +0 -0
- data/test/dummy/tmp/cache/3DB/E00/Comment%2F55 +0 -0
- data/test/dummy/tmp/cache/3DB/E10/Comment%2F64 +0 -0
- data/test/dummy/tmp/cache/3DB/E20/Comment%2F73 +0 -0
- data/test/dummy/tmp/cache/3DB/E30/Comment%2F82 +0 -0
- data/test/dummy/tmp/cache/3DC/DE0/Comment%2F29 +0 -0
- data/test/dummy/tmp/cache/3DC/DF0/Comment%2F38 +0 -0
- data/test/dummy/tmp/cache/3DC/E00/Comment%2F47 +0 -0
- data/test/dummy/tmp/cache/3DC/E20/Comment%2F65 +0 -0
- data/test/dummy/tmp/cache/3DC/E30/Comment%2F74 +0 -0
- data/test/dummy/tmp/cache/3DC/E40/Comment%2F83 +0 -0
- data/test/dummy/tmp/cache/3DD/E00/Comment%2F39 +0 -0
- data/test/dummy/tmp/cache/3DD/E10/Comment%2F48 +0 -0
- data/test/dummy/tmp/cache/3DD/E20/Comment%2F57 +0 -0
- data/test/dummy/tmp/cache/3DD/E40/Comment%2F75 +0 -0
- data/test/dummy/tmp/cache/3DD/E50/Comment%2F84 +0 -0
- data/test/dummy/tmp/cache/3DE/E20/Comment%2F49 +0 -0
- data/test/dummy/tmp/cache/3DE/E30/Comment%2F58 +0 -0
- data/test/dummy/tmp/cache/3DE/E40/Comment%2F67 +0 -0
- data/test/dummy/tmp/cache/3DE/E60/Comment%2F85 +0 -0
- data/test/dummy/tmp/cache/3DF/E40/Comment%2F59 +0 -0
- data/test/dummy/tmp/cache/3DF/E50/Comment%2F68 +0 -0
- data/test/dummy/tmp/cache/3DF/E60/Comment%2F77 +0 -0
- data/test/dummy/tmp/cache/3E0/E60/Comment%2F69 +0 -0
- data/test/dummy/tmp/cache/3E0/E70/Comment%2F78 +0 -0
- data/test/dummy/tmp/cache/3E1/E80/Comment%2F79 +0 -0
- data/test/dummy/tmp/cache/58D/B70/Post%2Fuser_id-1 +0 -1
- data/test/find_cache_test.rb +0 -57
- data/test/test_helper.rb +0 -16
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0e3782dcb68c139414274ce55f68926dda51f50d
|
4
|
+
data.tar.gz: 9ad0deb39629afb762d126f5671ffe3969e5092b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4f6652bc3ab5e060eddb69ef4fb1dd49ce7c2e98801a4d0027e8050cfd5b14b04a3d76b68991ef3764ec9fb7f4b0b8d6790a6296cd5dd40ebc19623f657dcfc9
|
7
|
+
data.tar.gz: 0d8a10d0ea7497e575ad210c4453eaccf9ea08064af6930d4e6053aaf743ded92e2af03d975b8c44dc4b41136a79c4994d955a4e7ad2f7f85250b3de7ffcb8b0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
@@ -1,34 +1,39 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
== CHANGE LOG
|
2
|
+
== version 0.3.0
|
3
|
+
# moved unit test to rspec tests
|
4
|
+
# auto handling counter_cache
|
5
|
+
# auto expires cache on reload
|
6
|
+
# controller based garbage collector added for find_cache data
|
3
7
|
|
4
|
-
version 0.2.
|
8
|
+
== version 0.2.1
|
9
|
+
# fixed expire_find_cache bug (which occured in v0.2.0)
|
10
|
+
|
11
|
+
== version 0.2.0
|
5
12
|
# find_by_id and find_all_by_id methods converted to where queries for rails 4
|
6
13
|
# id based queries replaced with primary_key based queries
|
7
14
|
|
8
|
-
version 0.1.8
|
15
|
+
== version 0.1.8
|
9
16
|
# local memorization on dynamic methods removed to prevent duplicate caching
|
10
17
|
|
11
|
-
version 0.1.7
|
18
|
+
== version 0.1.7
|
12
19
|
# code cleanup and documentation
|
13
20
|
|
14
|
-
version 0.1.6
|
21
|
+
== version 0.1.6
|
15
22
|
# after_commit on: :create, :update, :save instead of after_create, after_update, after_save callbacks
|
16
23
|
# fix thread cache key for dynamic class methods
|
17
24
|
|
18
|
-
version 0.1.5
|
25
|
+
== version 0.1.5
|
19
26
|
# naming fix
|
20
27
|
|
21
|
-
version 0.1.4
|
28
|
+
== version 0.1.4
|
22
29
|
# cache key bug fix
|
23
30
|
|
24
|
-
version 0.1.3
|
31
|
+
== version 0.1.3
|
25
32
|
# dependency updates to make it usable for all activerecord >3.0.0
|
26
33
|
|
27
|
-
version 0.1.0
|
34
|
+
== version 0.1.0
|
28
35
|
# 2012-08-25 Go public
|
29
36
|
# 2012-08-24 Added some tests
|
30
37
|
# 2012-08-23 Added thread safe cache method KeyGen.global_cache_key
|
31
38
|
|
32
|
-
version 0.0.1 (private)
|
33
|
-
# 2012-07-14 First release for http://videofork.com/
|
34
|
-
# YYYY-MM-DD Date format
|
39
|
+
== version 0.0.1 (private)
|
data/Gemfile
ADDED
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
== FindCache
|
2
2
|
|
3
|
-
It is simply
|
3
|
+
It is simply a thread-safe ActiveRecord object caching gem using Rails.cache methods.
|
4
4
|
|
5
5
|
It makes "ActiveRecord 'find_by_id, find_by_(attr)' methods and 'has_one, belongs_to' relations" cacheable by PrimaryKey(PK) or any referenced columns using Rails.cache methods. It also supports fetching multiple records using PKs(ids) with find_all_cache method(if cache store supports multiple reads [hint: memcached_store, dalli_store supports.]).
|
6
6
|
|
@@ -47,58 +47,16 @@ Or install it yourself as:
|
|
47
47
|
user.user_detail # fetches from DB
|
48
48
|
|
49
49
|
== For fetching multiple ids
|
50
|
-
|
50
|
+
|
51
51
|
users = User.find_all_cache([1,2,3,4,5])
|
52
|
-
|
52
|
+
users_ordered_desc = User.find_all_cache([4,5,1,2,3], 'id DESC')
|
53
|
+
users_ordered_asc = User.find_all_cache([4,5,1,2,3], 'id ASC')
|
54
|
+
|
53
55
|
== For fetching a record by attribute
|
54
56
|
|
55
57
|
user_detail = UserDetail.find_by_user_id(1) # from db
|
56
58
|
user_detail = UserDetail.find_cache_by_ref(:user_id, 1) # from cache store
|
57
59
|
|
58
|
-
== For counter_cache 'cache invalidation'
|
59
|
-
|
60
|
-
### Create a ruby file under config/initializers and add the following codes:
|
61
|
-
|
62
|
-
module ActiveRecord
|
63
|
-
module CounterCache
|
64
|
-
def increment_counter(counter_name, id)
|
65
|
-
expire_find_cache(name, id)
|
66
|
-
update_counters(id, counter_name => 1)
|
67
|
-
end
|
68
|
-
|
69
|
-
def decrement_counter(counter_name, id)
|
70
|
-
expire_find_cache(name, id)
|
71
|
-
update_counters(id, counter_name => -1)
|
72
|
-
end
|
73
|
-
|
74
|
-
def expire_find_cache(name, id)
|
75
|
-
key = FindCache::KeyGen.cache_key(name, id)
|
76
|
-
Rails.cache.delete(key)
|
77
|
-
$find_cache_store[FindCache::KeyGen.global_cache_key].delete(key)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
== Notes
|
83
|
-
|
84
|
-
If your worker thread does not kill itself after execution you should clean the find_cache_store manually. It can be done simple in ApplicationController of your rails app adding this method as after_filter
|
85
|
-
|
86
|
-
after_filter :clear_find_cache_store
|
87
|
-
|
88
|
-
def clear_find_cache_store
|
89
|
-
FindCache::KeyGen.clear_find_cache_store
|
90
|
-
end
|
91
|
-
|
92
|
-
Tested with dalli (https://github.com/mperham/dalli).
|
93
|
-
|
94
|
-
== Todo
|
95
|
-
|
96
|
-
More tests!
|
97
|
-
|
98
|
-
== Credits
|
99
|
-
|
100
|
-
FindCache is part of http://videofork.com project.
|
101
|
-
|
102
60
|
== Contributing
|
103
61
|
|
104
62
|
1. Fork it
|
data/Rakefile
CHANGED
@@ -1,38 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
rescue LoadError
|
5
|
-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
-
end
|
7
|
-
begin
|
8
|
-
require 'rdoc/task'
|
9
|
-
rescue LoadError
|
10
|
-
require 'rdoc/rdoc'
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
RDoc::Task = Rake::RDocTask
|
13
|
-
end
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
14
3
|
|
15
|
-
|
16
|
-
rdoc.rdoc_dir = 'rdoc'
|
17
|
-
rdoc.title = 'FindCache'
|
18
|
-
rdoc.options << '--line-numbers'
|
19
|
-
rdoc.rdoc_files.include('README.rdoc')
|
20
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
-
end
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
22
5
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Bundler::GemHelper.install_tasks
|
27
|
-
|
28
|
-
require 'rake/testtask'
|
29
|
-
|
30
|
-
Rake::TestTask.new(:test) do |t|
|
31
|
-
t.libs << 'lib'
|
32
|
-
t.libs << 'test'
|
33
|
-
t.pattern = 'test/**/*_test.rb'
|
34
|
-
t.verbose = false
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
task :default => :test
|
6
|
+
task :default => :spec
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "find_cache"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/find_cache.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'find_cache/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "find_cache"
|
8
|
+
spec.version = FindCache::VERSION
|
9
|
+
spec.authors = ["Mustafa Turan"]
|
10
|
+
spec.email = ["mustafaturan.net@gmail.com"]
|
11
|
+
spec.homepage = "https://github.com/mustafaturan/find_cache"
|
12
|
+
spec.summary = "Thread-safe cache for ActiveRecord >=3.0.0 find_by_PrimaryKey(id) and find_by_(attr) methods and models based on Rails.cache methods."
|
13
|
+
spec.description = "Makes ActiveRecord 'find_by_id, find_by_(attr)' methods and 'has_one, belongs_to' relations are cacheable by PrimaryKey(PK) or any referenced columns using Rails.cache methods. It also supports fetching multiple records using PKs(ids) with find_all_cache method(if cache store supports multiple reads [hint: memcached_store, dalli_store supports.])."
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = "exe"
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "activerecord", [">= 3.0.0"]
|
21
|
+
spec.add_dependency "activesupport", [">= 3.0.0"]
|
22
|
+
spec.add_dependency "railties", [">= 3.0.0"]
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.4.0"
|
26
|
+
spec.add_development_dependency "factory_girl", "~> 4.5.0"
|
27
|
+
spec.add_development_dependency "sqlite3", "~> 1.3.11"
|
28
|
+
spec.add_development_dependency "database_cleaner", "~> 1.5.1"
|
29
|
+
end
|
data/lib/find_cache.rb
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require "rails"
|
2
3
|
require "active_support"
|
3
4
|
require "active_record"
|
5
|
+
require "action_controller"
|
6
|
+
require "find_cache/version"
|
4
7
|
require "find_cache/init"
|
5
8
|
require "find_cache/key_gen"
|
6
|
-
require "find_cache/
|
9
|
+
require "find_cache/counter_cache"
|
10
|
+
require "find_cache/cacheable"
|
11
|
+
require "find_cache/controller_garbage_collector"
|
data/lib/find_cache/cacheable.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
module FindCache
|
3
|
-
|
3
|
+
|
4
4
|
# = FindCache Cachable
|
5
5
|
module Cacheable
|
6
6
|
extend ActiveSupport::Concern
|
@@ -16,14 +16,14 @@ module FindCache
|
|
16
16
|
#
|
17
17
|
# ==== Examples
|
18
18
|
#
|
19
|
-
# # For User model with user_id
|
19
|
+
# # For User model with user_id ForeignKey in UserDetail model
|
20
20
|
# find_cache_has_one :user_detail, UserDetail, :user_id
|
21
21
|
def find_cache_has_one(attribute, model, foreign_key)
|
22
22
|
send :define_method, attribute.to_sym do |*args|
|
23
23
|
model.find_cache_by_ref(foreign_key, self.send(self.class.primary_key.to_sym))
|
24
24
|
end
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
# belongs_to relational caching with find_cache
|
28
28
|
#
|
29
29
|
# ==== Parameters
|
@@ -34,7 +34,7 @@ module FindCache
|
|
34
34
|
#
|
35
35
|
# ==== Examples
|
36
36
|
#
|
37
|
-
# # In UserDetail model with user_id
|
37
|
+
# # In UserDetail model with user_id ForeignKey of User model
|
38
38
|
# find_cache_belongs_to :user, User, :user_id
|
39
39
|
def find_cache_belongs_to(attribute, model, foreign_key)
|
40
40
|
send :define_method, attribute.to_sym do |*args|
|
@@ -88,7 +88,6 @@ module FindCache
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
-
|
92
91
|
# To find all Active Record objects using id list
|
93
92
|
#
|
94
93
|
# ==== Parameters
|
@@ -127,16 +126,42 @@ module FindCache
|
|
127
126
|
all_new_cache.each do |cached_item|
|
128
127
|
$find_cache_store[KeyGen.global_cache_key][KeyGen.cache_key(name, cached_item.send(primary_key.to_sym))] = cached_item
|
129
128
|
end
|
130
|
-
|
129
|
+
order_attr, order_direction = order_by.split(' ')
|
130
|
+
ordered_cache = all_new_cache.sort_by { |item| item.send(order_attr) }
|
131
|
+
order_direction.eql?('DESC') ? ordered_cache.reverse : ordered_cache
|
132
|
+
end
|
133
|
+
|
134
|
+
# Expire cache for given name and pk val
|
135
|
+
#
|
136
|
+
# ==== Parameters
|
137
|
+
#
|
138
|
+
# * +pk_val+ - pk val
|
139
|
+
#
|
140
|
+
def expire_find_cache(pk_val)
|
141
|
+
key = KeyGen.cache_key(name, pk_val)
|
142
|
+
Rails.cache.delete(key)
|
143
|
+
$find_cache_store[KeyGen.global_cache_key].delete(key)
|
144
|
+
end
|
131
145
|
end
|
132
|
-
|
146
|
+
|
133
147
|
included do
|
134
|
-
|
135
|
-
|
148
|
+
after_save :expire_find_cache
|
149
|
+
after_destroy :expire_find_cache
|
150
|
+
|
151
|
+
# Expires the cache on reload
|
152
|
+
#
|
153
|
+
def reload
|
154
|
+
expire_find_cache
|
155
|
+
super
|
156
|
+
end
|
157
|
+
|
158
|
+
# Expires the cache
|
159
|
+
#
|
136
160
|
def expire_find_cache
|
137
|
-
|
138
|
-
|
139
|
-
|
161
|
+
return if self.class.primary_key.blank?
|
162
|
+
self.class.expire_find_cache(
|
163
|
+
self.send(self.class.primary_key.to_sym)
|
164
|
+
)
|
140
165
|
end
|
141
166
|
end
|
142
167
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module FindCache
|
3
|
+
# = FindCache ControllerGarbageCollector
|
4
|
+
module ControllerGarbageCollector
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
# Garbage collector for current thread
|
9
|
+
after_filter :clear_find_cache_store
|
10
|
+
|
11
|
+
def clear_find_cache_store
|
12
|
+
FindCache::KeyGen.clear_find_cache_store
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
ActionController::Base.send :include, FindCache::ControllerGarbageCollector
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
module FindCache
|
3
|
+
# = FindCache ControllerGarbageCollector
|
4
|
+
module CounterCache
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
module ClassMethods
|
7
|
+
def update_counters(id, counters)
|
8
|
+
super
|
9
|
+
expire_find_cache(id)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
ActiveRecord::Base.send :include, FindCache::CounterCache
|
data/lib/find_cache/key_gen.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
module FindCache
|
3
|
+
# = FindCache KeyGen
|
3
4
|
class KeyGen
|
4
|
-
require "simple_uuid"
|
5
5
|
|
6
6
|
# cache_key generator for model items
|
7
7
|
#
|
@@ -46,11 +46,7 @@ module FindCache
|
|
46
46
|
# FindCache::KeyGen.global_cache_key(true)
|
47
47
|
def self.global_cache_key(clear = false)
|
48
48
|
return (Thread.current[:global_cache_key] = nil) if clear
|
49
|
-
Thread.current[:global_cache_key] ||=
|
50
|
-
t = SimpleUUID::UUID.new(Time.now).to_i.to_s(16).rjust(32, "0")
|
51
|
-
$find_cache_store[t] = {}
|
52
|
-
t
|
53
|
-
)
|
49
|
+
Thread.current[:global_cache_key] ||= generate_uuid_and_init_cache_hash
|
54
50
|
end
|
55
51
|
|
56
52
|
# Cleaning all caches of the current Thread not the Rails.cache
|
@@ -59,5 +55,13 @@ module FindCache
|
|
59
55
|
$find_cache_store.delete(KeyGen.global_cache_key)
|
60
56
|
KeyGen.global_cache_key(true)
|
61
57
|
end
|
58
|
+
|
59
|
+
private
|
60
|
+
#nodoc
|
61
|
+
def self.generate_uuid_and_init_cache_hash
|
62
|
+
uuid = SecureRandom.uuid.gsub('-', '')
|
63
|
+
$find_cache_store[uuid] = {}
|
64
|
+
uuid
|
65
|
+
end
|
62
66
|
end
|
63
67
|
end
|
data/lib/find_cache/version.rb
CHANGED
metadata
CHANGED
@@ -1,426 +1,191 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: find_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mustafa Turan
|
9
8
|
autorequire:
|
10
|
-
bindir:
|
9
|
+
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.0.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: activesupport
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 3.0.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 3.0.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
42
|
+
name: railties
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
47
|
+
version: 3.0.0
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
60
67
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
68
|
+
version: '1.10'
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
70
|
+
name: rake
|
64
71
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
72
|
requirements:
|
67
|
-
- - ~>
|
73
|
+
- - "~>"
|
68
74
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
75
|
+
version: '10.0'
|
70
76
|
type: :development
|
71
77
|
prerelease: false
|
72
78
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
79
|
requirements:
|
75
|
-
- - ~>
|
80
|
+
- - "~>"
|
76
81
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.4.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.4.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: factory_girl
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 4.5.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 4.5.0
|
78
111
|
- !ruby/object:Gem::Dependency
|
79
112
|
name: sqlite3
|
80
113
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
114
|
requirements:
|
83
|
-
- -
|
115
|
+
- - "~>"
|
84
116
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
117
|
+
version: 1.3.11
|
86
118
|
type: :development
|
87
119
|
prerelease: false
|
88
120
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
121
|
requirements:
|
91
|
-
- -
|
122
|
+
- - "~>"
|
92
123
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
124
|
+
version: 1.3.11
|
94
125
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
126
|
+
name: database_cleaner
|
96
127
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
128
|
requirements:
|
99
|
-
- - ~>
|
129
|
+
- - "~>"
|
100
130
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
131
|
+
version: 1.5.1
|
102
132
|
type: :development
|
103
133
|
prerelease: false
|
104
134
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
135
|
requirements:
|
107
|
-
- - ~>
|
136
|
+
- - "~>"
|
108
137
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
110
|
-
description:
|
111
|
-
|
138
|
+
version: 1.5.1
|
139
|
+
description: 'Makes ActiveRecord ''find_by_id, find_by_(attr)'' methods and ''has_one,
|
140
|
+
belongs_to'' relations are cacheable by PrimaryKey(PK) or any referenced columns
|
112
141
|
using Rails.cache methods. It also supports fetching multiple records using PKs(ids)
|
113
|
-
with find_all_cache method(if cache store supports multiple reads [hint:
|
114
|
-
dalli_store
|
142
|
+
with find_all_cache method(if cache store supports multiple reads [hint: memcached_store,
|
143
|
+
dalli_store supports.]).'
|
115
144
|
email:
|
116
145
|
- mustafaturan.net@gmail.com
|
117
146
|
executables: []
|
118
147
|
extensions: []
|
119
148
|
extra_rdoc_files: []
|
120
149
|
files:
|
150
|
+
- ".gitignore"
|
151
|
+
- ".rspec"
|
152
|
+
- ".travis.yml"
|
153
|
+
- CHANGE_LOG.rdoc
|
154
|
+
- Gemfile
|
155
|
+
- README.rdoc
|
156
|
+
- Rakefile
|
157
|
+
- bin/console
|
158
|
+
- bin/setup
|
159
|
+
- find_cache.gemspec
|
160
|
+
- lib/find_cache.rb
|
121
161
|
- lib/find_cache/cacheable.rb
|
162
|
+
- lib/find_cache/controller_garbage_collector.rb
|
163
|
+
- lib/find_cache/counter_cache.rb
|
122
164
|
- lib/find_cache/init.rb
|
123
165
|
- lib/find_cache/key_gen.rb
|
124
166
|
- lib/find_cache/version.rb
|
125
|
-
- lib/find_cache.rb
|
126
|
-
- lib/tasks/find_cache_tasks.rake
|
127
|
-
- CHANGE-LOG
|
128
|
-
- MIT-LICENSE
|
129
|
-
- Rakefile
|
130
|
-
- README.rdoc
|
131
|
-
- test/dummy/app/assets/javascripts/application.js
|
132
|
-
- test/dummy/app/assets/stylesheets/application.css
|
133
|
-
- test/dummy/app/controllers/application_controller.rb
|
134
|
-
- test/dummy/app/helpers/application_helper.rb
|
135
|
-
- test/dummy/app/models/comment.rb
|
136
|
-
- test/dummy/app/models/post.rb
|
137
|
-
- test/dummy/app/models/user.rb
|
138
|
-
- test/dummy/app/views/layouts/application.html.erb
|
139
|
-
- test/dummy/config/application.rb
|
140
|
-
- test/dummy/config/boot.rb
|
141
|
-
- test/dummy/config/database.yml
|
142
|
-
- test/dummy/config/environment.rb
|
143
|
-
- test/dummy/config/environments/development.rb
|
144
|
-
- test/dummy/config/environments/production.rb
|
145
|
-
- test/dummy/config/environments/test.rb
|
146
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
147
|
-
- test/dummy/config/initializers/counter_cache_patch.rb
|
148
|
-
- test/dummy/config/initializers/inflections.rb
|
149
|
-
- test/dummy/config/initializers/mime_types.rb
|
150
|
-
- test/dummy/config/initializers/secret_token.rb
|
151
|
-
- test/dummy/config/initializers/session_store.rb
|
152
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
153
|
-
- test/dummy/config/locales/en.yml
|
154
|
-
- test/dummy/config/routes.rb
|
155
|
-
- test/dummy/config.ru
|
156
|
-
- test/dummy/db/development.sqlite3
|
157
|
-
- test/dummy/db/migrate/20120824210455_create_users.rb
|
158
|
-
- test/dummy/db/migrate/20120824210731_create_comments.rb
|
159
|
-
- test/dummy/db/migrate/20120824210927_create_posts.rb
|
160
|
-
- test/dummy/db/schema.rb
|
161
|
-
- test/dummy/db/test.sqlite3
|
162
|
-
- test/dummy/log/test.log
|
163
|
-
- test/dummy/public/404.html
|
164
|
-
- test/dummy/public/422.html
|
165
|
-
- test/dummy/public/500.html
|
166
|
-
- test/dummy/public/favicon.ico
|
167
|
-
- test/dummy/Rakefile
|
168
|
-
- test/dummy/README.rdoc
|
169
|
-
- test/dummy/script/rails
|
170
|
-
- test/dummy/test/fixtures/comments.yml
|
171
|
-
- test/dummy/test/fixtures/posts.yml
|
172
|
-
- test/dummy/test/fixtures/users.yml
|
173
|
-
- test/dummy/test/unit/comment_test.rb
|
174
|
-
- test/dummy/test/unit/post_test.rb
|
175
|
-
- test/dummy/test/unit/user_test.rb
|
176
|
-
- test/dummy/tmp/cache/26E/540/User%2F1
|
177
|
-
- test/dummy/tmp/cache/26F/550/User%2F2
|
178
|
-
- test/dummy/tmp/cache/270/560/User%2F3
|
179
|
-
- test/dummy/tmp/cache/271/570/User%2F4
|
180
|
-
- test/dummy/tmp/cache/272/580/User%2F5
|
181
|
-
- test/dummy/tmp/cache/273/590/User%2F6
|
182
|
-
- test/dummy/tmp/cache/274/5A0/User%2F7
|
183
|
-
- test/dummy/tmp/cache/275/5B0/User%2F8
|
184
|
-
- test/dummy/tmp/cache/275/6E0/Post%2F1
|
185
|
-
- test/dummy/tmp/cache/276/5C0/User%2F9
|
186
|
-
- test/dummy/tmp/cache/276/6F0/Post%2F2
|
187
|
-
- test/dummy/tmp/cache/277/700/Post%2F3
|
188
|
-
- test/dummy/tmp/cache/29E/F20/User%2F10
|
189
|
-
- test/dummy/tmp/cache/29F/F30/User%2F11
|
190
|
-
- test/dummy/tmp/cache/29F/F40/User%2F20
|
191
|
-
- test/dummy/tmp/cache/2A0/F40/User%2F12
|
192
|
-
- test/dummy/tmp/cache/2A1/F50/User%2F13
|
193
|
-
- test/dummy/tmp/cache/2A2/F60/User%2F14
|
194
|
-
- test/dummy/tmp/cache/2A3/F70/User%2F15
|
195
|
-
- test/dummy/tmp/cache/2A4/F80/User%2F16
|
196
|
-
- test/dummy/tmp/cache/2A5/F90/User%2F17
|
197
|
-
- test/dummy/tmp/cache/2A6/FA0/User%2F18
|
198
|
-
- test/dummy/tmp/cache/2A7/FB0/User%2F19
|
199
|
-
- test/dummy/tmp/cache/3A8/070/Comment%2F7
|
200
|
-
- test/dummy/tmp/cache/3A9/080/Comment%2F8
|
201
|
-
- test/dummy/tmp/cache/3AA/090/Comment%2F9
|
202
|
-
- test/dummy/tmp/cache/3D2/D30/Comment%2F10
|
203
|
-
- test/dummy/tmp/cache/3D3/D50/Comment%2F20
|
204
|
-
- test/dummy/tmp/cache/3D4/D50/Comment%2F12
|
205
|
-
- test/dummy/tmp/cache/3D4/D70/Comment%2F30
|
206
|
-
- test/dummy/tmp/cache/3D5/D60/Comment%2F13
|
207
|
-
- test/dummy/tmp/cache/3D5/D70/Comment%2F22
|
208
|
-
- test/dummy/tmp/cache/3D5/D90/Comment%2F40
|
209
|
-
- test/dummy/tmp/cache/3D6/D70/Comment%2F14
|
210
|
-
- test/dummy/tmp/cache/3D6/D80/Comment%2F23
|
211
|
-
- test/dummy/tmp/cache/3D6/D90/Comment%2F32
|
212
|
-
- test/dummy/tmp/cache/3D6/DB0/Comment%2F50
|
213
|
-
- test/dummy/tmp/cache/3D7/D80/Comment%2F15
|
214
|
-
- test/dummy/tmp/cache/3D7/D90/Comment%2F24
|
215
|
-
- test/dummy/tmp/cache/3D7/DA0/Comment%2F33
|
216
|
-
- test/dummy/tmp/cache/3D7/DB0/Comment%2F42
|
217
|
-
- test/dummy/tmp/cache/3D7/DD0/Comment%2F60
|
218
|
-
- test/dummy/tmp/cache/3D8/DA0/Comment%2F25
|
219
|
-
- test/dummy/tmp/cache/3D8/DB0/Comment%2F34
|
220
|
-
- test/dummy/tmp/cache/3D8/DC0/Comment%2F43
|
221
|
-
- test/dummy/tmp/cache/3D8/DD0/Comment%2F52
|
222
|
-
- test/dummy/tmp/cache/3D8/DF0/Comment%2F70
|
223
|
-
- test/dummy/tmp/cache/3D9/DA0/Comment%2F17
|
224
|
-
- test/dummy/tmp/cache/3D9/DC0/Comment%2F35
|
225
|
-
- test/dummy/tmp/cache/3D9/DD0/Comment%2F44
|
226
|
-
- test/dummy/tmp/cache/3D9/DE0/Comment%2F53
|
227
|
-
- test/dummy/tmp/cache/3D9/DF0/Comment%2F62
|
228
|
-
- test/dummy/tmp/cache/3D9/E10/Comment%2F80
|
229
|
-
- test/dummy/tmp/cache/3DA/DB0/Comment%2F18
|
230
|
-
- test/dummy/tmp/cache/3DA/DC0/Comment%2F27
|
231
|
-
- test/dummy/tmp/cache/3DA/DE0/Comment%2F45
|
232
|
-
- test/dummy/tmp/cache/3DA/DF0/Comment%2F54
|
233
|
-
- test/dummy/tmp/cache/3DA/E00/Comment%2F63
|
234
|
-
- test/dummy/tmp/cache/3DA/E10/Comment%2F72
|
235
|
-
- test/dummy/tmp/cache/3DB/DC0/Comment%2F19
|
236
|
-
- test/dummy/tmp/cache/3DB/DD0/Comment%2F28
|
237
|
-
- test/dummy/tmp/cache/3DB/DE0/Comment%2F37
|
238
|
-
- test/dummy/tmp/cache/3DB/E00/Comment%2F55
|
239
|
-
- test/dummy/tmp/cache/3DB/E10/Comment%2F64
|
240
|
-
- test/dummy/tmp/cache/3DB/E20/Comment%2F73
|
241
|
-
- test/dummy/tmp/cache/3DB/E30/Comment%2F82
|
242
|
-
- test/dummy/tmp/cache/3DC/DE0/Comment%2F29
|
243
|
-
- test/dummy/tmp/cache/3DC/DF0/Comment%2F38
|
244
|
-
- test/dummy/tmp/cache/3DC/E00/Comment%2F47
|
245
|
-
- test/dummy/tmp/cache/3DC/E20/Comment%2F65
|
246
|
-
- test/dummy/tmp/cache/3DC/E30/Comment%2F74
|
247
|
-
- test/dummy/tmp/cache/3DC/E40/Comment%2F83
|
248
|
-
- test/dummy/tmp/cache/3DD/E00/Comment%2F39
|
249
|
-
- test/dummy/tmp/cache/3DD/E10/Comment%2F48
|
250
|
-
- test/dummy/tmp/cache/3DD/E20/Comment%2F57
|
251
|
-
- test/dummy/tmp/cache/3DD/E40/Comment%2F75
|
252
|
-
- test/dummy/tmp/cache/3DD/E50/Comment%2F84
|
253
|
-
- test/dummy/tmp/cache/3DE/E20/Comment%2F49
|
254
|
-
- test/dummy/tmp/cache/3DE/E30/Comment%2F58
|
255
|
-
- test/dummy/tmp/cache/3DE/E40/Comment%2F67
|
256
|
-
- test/dummy/tmp/cache/3DE/E60/Comment%2F85
|
257
|
-
- test/dummy/tmp/cache/3DF/E40/Comment%2F59
|
258
|
-
- test/dummy/tmp/cache/3DF/E50/Comment%2F68
|
259
|
-
- test/dummy/tmp/cache/3DF/E60/Comment%2F77
|
260
|
-
- test/dummy/tmp/cache/3E0/E60/Comment%2F69
|
261
|
-
- test/dummy/tmp/cache/3E0/E70/Comment%2F78
|
262
|
-
- test/dummy/tmp/cache/3E1/E80/Comment%2F79
|
263
|
-
- test/dummy/tmp/cache/58D/B70/Post%2Fuser_id-1
|
264
|
-
- test/find_cache_test.rb
|
265
|
-
- test/test_helper.rb
|
266
167
|
homepage: https://github.com/mustafaturan/find_cache
|
267
168
|
licenses: []
|
169
|
+
metadata: {}
|
268
170
|
post_install_message:
|
269
171
|
rdoc_options: []
|
270
172
|
require_paths:
|
271
173
|
- lib
|
272
174
|
required_ruby_version: !ruby/object:Gem::Requirement
|
273
|
-
none: false
|
274
175
|
requirements:
|
275
|
-
- -
|
176
|
+
- - ">="
|
276
177
|
- !ruby/object:Gem::Version
|
277
178
|
version: '0'
|
278
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
|
-
none: false
|
280
180
|
requirements:
|
281
|
-
- -
|
181
|
+
- - ">="
|
282
182
|
- !ruby/object:Gem::Version
|
283
183
|
version: '0'
|
284
184
|
requirements: []
|
285
185
|
rubyforge_project:
|
286
|
-
rubygems_version:
|
186
|
+
rubygems_version: 2.4.5.1
|
287
187
|
signing_key:
|
288
|
-
specification_version:
|
289
|
-
summary:
|
290
|
-
methods based on Rails.cache methods.
|
291
|
-
test_files:
|
292
|
-
- test/dummy/app/assets/javascripts/application.js
|
293
|
-
- test/dummy/app/assets/stylesheets/application.css
|
294
|
-
- test/dummy/app/controllers/application_controller.rb
|
295
|
-
- test/dummy/app/helpers/application_helper.rb
|
296
|
-
- test/dummy/app/models/comment.rb
|
297
|
-
- test/dummy/app/models/post.rb
|
298
|
-
- test/dummy/app/models/user.rb
|
299
|
-
- test/dummy/app/views/layouts/application.html.erb
|
300
|
-
- test/dummy/config/application.rb
|
301
|
-
- test/dummy/config/boot.rb
|
302
|
-
- test/dummy/config/database.yml
|
303
|
-
- test/dummy/config/environment.rb
|
304
|
-
- test/dummy/config/environments/development.rb
|
305
|
-
- test/dummy/config/environments/production.rb
|
306
|
-
- test/dummy/config/environments/test.rb
|
307
|
-
- test/dummy/config/initializers/backtrace_silencers.rb
|
308
|
-
- test/dummy/config/initializers/counter_cache_patch.rb
|
309
|
-
- test/dummy/config/initializers/inflections.rb
|
310
|
-
- test/dummy/config/initializers/mime_types.rb
|
311
|
-
- test/dummy/config/initializers/secret_token.rb
|
312
|
-
- test/dummy/config/initializers/session_store.rb
|
313
|
-
- test/dummy/config/initializers/wrap_parameters.rb
|
314
|
-
- test/dummy/config/locales/en.yml
|
315
|
-
- test/dummy/config/routes.rb
|
316
|
-
- test/dummy/config.ru
|
317
|
-
- test/dummy/db/development.sqlite3
|
318
|
-
- test/dummy/db/migrate/20120824210455_create_users.rb
|
319
|
-
- test/dummy/db/migrate/20120824210731_create_comments.rb
|
320
|
-
- test/dummy/db/migrate/20120824210927_create_posts.rb
|
321
|
-
- test/dummy/db/schema.rb
|
322
|
-
- test/dummy/db/test.sqlite3
|
323
|
-
- test/dummy/log/test.log
|
324
|
-
- test/dummy/public/404.html
|
325
|
-
- test/dummy/public/422.html
|
326
|
-
- test/dummy/public/500.html
|
327
|
-
- test/dummy/public/favicon.ico
|
328
|
-
- test/dummy/Rakefile
|
329
|
-
- test/dummy/README.rdoc
|
330
|
-
- test/dummy/script/rails
|
331
|
-
- test/dummy/test/fixtures/comments.yml
|
332
|
-
- test/dummy/test/fixtures/posts.yml
|
333
|
-
- test/dummy/test/fixtures/users.yml
|
334
|
-
- test/dummy/test/unit/comment_test.rb
|
335
|
-
- test/dummy/test/unit/post_test.rb
|
336
|
-
- test/dummy/test/unit/user_test.rb
|
337
|
-
- test/dummy/tmp/cache/26E/540/User%2F1
|
338
|
-
- test/dummy/tmp/cache/26F/550/User%2F2
|
339
|
-
- test/dummy/tmp/cache/270/560/User%2F3
|
340
|
-
- test/dummy/tmp/cache/271/570/User%2F4
|
341
|
-
- test/dummy/tmp/cache/272/580/User%2F5
|
342
|
-
- test/dummy/tmp/cache/273/590/User%2F6
|
343
|
-
- test/dummy/tmp/cache/274/5A0/User%2F7
|
344
|
-
- test/dummy/tmp/cache/275/5B0/User%2F8
|
345
|
-
- test/dummy/tmp/cache/275/6E0/Post%2F1
|
346
|
-
- test/dummy/tmp/cache/276/5C0/User%2F9
|
347
|
-
- test/dummy/tmp/cache/276/6F0/Post%2F2
|
348
|
-
- test/dummy/tmp/cache/277/700/Post%2F3
|
349
|
-
- test/dummy/tmp/cache/29E/F20/User%2F10
|
350
|
-
- test/dummy/tmp/cache/29F/F30/User%2F11
|
351
|
-
- test/dummy/tmp/cache/29F/F40/User%2F20
|
352
|
-
- test/dummy/tmp/cache/2A0/F40/User%2F12
|
353
|
-
- test/dummy/tmp/cache/2A1/F50/User%2F13
|
354
|
-
- test/dummy/tmp/cache/2A2/F60/User%2F14
|
355
|
-
- test/dummy/tmp/cache/2A3/F70/User%2F15
|
356
|
-
- test/dummy/tmp/cache/2A4/F80/User%2F16
|
357
|
-
- test/dummy/tmp/cache/2A5/F90/User%2F17
|
358
|
-
- test/dummy/tmp/cache/2A6/FA0/User%2F18
|
359
|
-
- test/dummy/tmp/cache/2A7/FB0/User%2F19
|
360
|
-
- test/dummy/tmp/cache/3A8/070/Comment%2F7
|
361
|
-
- test/dummy/tmp/cache/3A9/080/Comment%2F8
|
362
|
-
- test/dummy/tmp/cache/3AA/090/Comment%2F9
|
363
|
-
- test/dummy/tmp/cache/3D2/D30/Comment%2F10
|
364
|
-
- test/dummy/tmp/cache/3D3/D50/Comment%2F20
|
365
|
-
- test/dummy/tmp/cache/3D4/D50/Comment%2F12
|
366
|
-
- test/dummy/tmp/cache/3D4/D70/Comment%2F30
|
367
|
-
- test/dummy/tmp/cache/3D5/D60/Comment%2F13
|
368
|
-
- test/dummy/tmp/cache/3D5/D70/Comment%2F22
|
369
|
-
- test/dummy/tmp/cache/3D5/D90/Comment%2F40
|
370
|
-
- test/dummy/tmp/cache/3D6/D70/Comment%2F14
|
371
|
-
- test/dummy/tmp/cache/3D6/D80/Comment%2F23
|
372
|
-
- test/dummy/tmp/cache/3D6/D90/Comment%2F32
|
373
|
-
- test/dummy/tmp/cache/3D6/DB0/Comment%2F50
|
374
|
-
- test/dummy/tmp/cache/3D7/D80/Comment%2F15
|
375
|
-
- test/dummy/tmp/cache/3D7/D90/Comment%2F24
|
376
|
-
- test/dummy/tmp/cache/3D7/DA0/Comment%2F33
|
377
|
-
- test/dummy/tmp/cache/3D7/DB0/Comment%2F42
|
378
|
-
- test/dummy/tmp/cache/3D7/DD0/Comment%2F60
|
379
|
-
- test/dummy/tmp/cache/3D8/DA0/Comment%2F25
|
380
|
-
- test/dummy/tmp/cache/3D8/DB0/Comment%2F34
|
381
|
-
- test/dummy/tmp/cache/3D8/DC0/Comment%2F43
|
382
|
-
- test/dummy/tmp/cache/3D8/DD0/Comment%2F52
|
383
|
-
- test/dummy/tmp/cache/3D8/DF0/Comment%2F70
|
384
|
-
- test/dummy/tmp/cache/3D9/DA0/Comment%2F17
|
385
|
-
- test/dummy/tmp/cache/3D9/DC0/Comment%2F35
|
386
|
-
- test/dummy/tmp/cache/3D9/DD0/Comment%2F44
|
387
|
-
- test/dummy/tmp/cache/3D9/DE0/Comment%2F53
|
388
|
-
- test/dummy/tmp/cache/3D9/DF0/Comment%2F62
|
389
|
-
- test/dummy/tmp/cache/3D9/E10/Comment%2F80
|
390
|
-
- test/dummy/tmp/cache/3DA/DB0/Comment%2F18
|
391
|
-
- test/dummy/tmp/cache/3DA/DC0/Comment%2F27
|
392
|
-
- test/dummy/tmp/cache/3DA/DE0/Comment%2F45
|
393
|
-
- test/dummy/tmp/cache/3DA/DF0/Comment%2F54
|
394
|
-
- test/dummy/tmp/cache/3DA/E00/Comment%2F63
|
395
|
-
- test/dummy/tmp/cache/3DA/E10/Comment%2F72
|
396
|
-
- test/dummy/tmp/cache/3DB/DC0/Comment%2F19
|
397
|
-
- test/dummy/tmp/cache/3DB/DD0/Comment%2F28
|
398
|
-
- test/dummy/tmp/cache/3DB/DE0/Comment%2F37
|
399
|
-
- test/dummy/tmp/cache/3DB/E00/Comment%2F55
|
400
|
-
- test/dummy/tmp/cache/3DB/E10/Comment%2F64
|
401
|
-
- test/dummy/tmp/cache/3DB/E20/Comment%2F73
|
402
|
-
- test/dummy/tmp/cache/3DB/E30/Comment%2F82
|
403
|
-
- test/dummy/tmp/cache/3DC/DE0/Comment%2F29
|
404
|
-
- test/dummy/tmp/cache/3DC/DF0/Comment%2F38
|
405
|
-
- test/dummy/tmp/cache/3DC/E00/Comment%2F47
|
406
|
-
- test/dummy/tmp/cache/3DC/E20/Comment%2F65
|
407
|
-
- test/dummy/tmp/cache/3DC/E30/Comment%2F74
|
408
|
-
- test/dummy/tmp/cache/3DC/E40/Comment%2F83
|
409
|
-
- test/dummy/tmp/cache/3DD/E00/Comment%2F39
|
410
|
-
- test/dummy/tmp/cache/3DD/E10/Comment%2F48
|
411
|
-
- test/dummy/tmp/cache/3DD/E20/Comment%2F57
|
412
|
-
- test/dummy/tmp/cache/3DD/E40/Comment%2F75
|
413
|
-
- test/dummy/tmp/cache/3DD/E50/Comment%2F84
|
414
|
-
- test/dummy/tmp/cache/3DE/E20/Comment%2F49
|
415
|
-
- test/dummy/tmp/cache/3DE/E30/Comment%2F58
|
416
|
-
- test/dummy/tmp/cache/3DE/E40/Comment%2F67
|
417
|
-
- test/dummy/tmp/cache/3DE/E60/Comment%2F85
|
418
|
-
- test/dummy/tmp/cache/3DF/E40/Comment%2F59
|
419
|
-
- test/dummy/tmp/cache/3DF/E50/Comment%2F68
|
420
|
-
- test/dummy/tmp/cache/3DF/E60/Comment%2F77
|
421
|
-
- test/dummy/tmp/cache/3E0/E60/Comment%2F69
|
422
|
-
- test/dummy/tmp/cache/3E0/E70/Comment%2F78
|
423
|
-
- test/dummy/tmp/cache/3E1/E80/Comment%2F79
|
424
|
-
- test/dummy/tmp/cache/58D/B70/Post%2Fuser_id-1
|
425
|
-
- test/find_cache_test.rb
|
426
|
-
- test/test_helper.rb
|
188
|
+
specification_version: 4
|
189
|
+
summary: Thread-safe cache for ActiveRecord >=3.0.0 find_by_PrimaryKey(id) and find_by_(attr)
|
190
|
+
methods and models based on Rails.cache methods.
|
191
|
+
test_files: []
|