cache_fu 0.1.4 → 0.1.5
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/lib/acts_as_cached/config.rb +0 -5
- data/lib/acts_as_cached/railtie.rb +1 -0
- metadata +2 -3
- data/lib/cache_fu.rb~ +0 -61
@@ -60,7 +60,6 @@ module ActsAsCached
|
|
60
60
|
SESSION_CACHE.servers = Array(config[:session_servers]) if config[:session_servers]
|
61
61
|
|
62
62
|
setup_session_store if config[:sessions]
|
63
|
-
setup_fragment_store! if config[:fragments]
|
64
63
|
setup_fast_hash! if config[:fast_hash]
|
65
64
|
setup_fastest_hash! if config[:fastest_hash]
|
66
65
|
|
@@ -86,10 +85,6 @@ module ActsAsCached
|
|
86
85
|
)
|
87
86
|
end
|
88
87
|
|
89
|
-
def setup_fragment_store!
|
90
|
-
ActsAsCached::FragmentCache.setup!
|
91
|
-
end
|
92
|
-
|
93
88
|
# break compatiblity with non-ruby memcache clients in exchange for speedup.
|
94
89
|
# consistent across all platforms.
|
95
90
|
def setup_fast_hash!
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cache_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Surendra Singhi
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-10-13 00:00:00 +05:30
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -52,7 +52,6 @@ files:
|
|
52
52
|
- lib/acts_as_cached/railtie.rb
|
53
53
|
- lib/acts_as_cached/recipes.rb
|
54
54
|
- lib/cache_fu.rb
|
55
|
-
- lib/cache_fu.rb~
|
56
55
|
- lib/tasks/memcached.rake
|
57
56
|
- test/benchmarking_test.rb
|
58
57
|
- test/cache_test.rb
|
data/lib/cache_fu.rb~
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/acts_as_cached/config'
|
2
|
-
require File.dirname(__FILE__) + '/acts_as_cached/cache_methods'
|
3
|
-
require File.dirname(__FILE__) + '/acts_as_cached/fragment_cache'
|
4
|
-
require File.dirname(__FILE__) + '/acts_as_cached/benchmarking'
|
5
|
-
require File.dirname(__FILE__) + '/acts_as_cached/disabled'
|
6
|
-
require File.dirname(__FILE__) + '/acts_as_cached/local_cache'
|
7
|
-
require File.dirname(__FILE__) + '/acts_as_cached/railtie' if defined?(Rails::Railtie)
|
8
|
-
|
9
|
-
module ActsAsCached
|
10
|
-
@@config = {}
|
11
|
-
mattr_reader :config
|
12
|
-
|
13
|
-
def self.config=(options)
|
14
|
-
@@config = Config.setup options
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.skip_cache_gets=(boolean)
|
18
|
-
ActsAsCached.config[:skip_gets] = boolean
|
19
|
-
end
|
20
|
-
|
21
|
-
module Mixin
|
22
|
-
def acts_as_cached(options = {})
|
23
|
-
extend ClassMethods
|
24
|
-
include InstanceMethods
|
25
|
-
|
26
|
-
extend Extensions::ClassMethods if defined? Extensions::ClassMethods
|
27
|
-
include Extensions::InstanceMethods if defined? Extensions::InstanceMethods
|
28
|
-
|
29
|
-
options.symbolize_keys!
|
30
|
-
|
31
|
-
options[:store] ||= ActsAsCached.config[:store]
|
32
|
-
options[:ttl] ||= ActsAsCached.config[:ttl]
|
33
|
-
|
34
|
-
# convert the find_by shorthand
|
35
|
-
if find_by = options.delete(:find_by)
|
36
|
-
options[:finder] = "find_by_#{find_by}".to_sym
|
37
|
-
options[:cache_id] = find_by
|
38
|
-
end
|
39
|
-
|
40
|
-
cache_config.replace options.reject { |key,| not Config.valued_keys.include? key }
|
41
|
-
cache_options.replace options.reject { |key,| Config.valued_keys.include? key }
|
42
|
-
|
43
|
-
Disabled.add_to self and return if ActsAsCached.config[:disabled]
|
44
|
-
Benchmarking.add_to self if ActsAsCached.config[:benchmarking]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class CacheException < StandardError; end
|
49
|
-
class NoCacheStore < CacheException; end
|
50
|
-
class NoGetMulti < CacheException; end
|
51
|
-
end
|
52
|
-
|
53
|
-
Object.send :include, ActsAsCached::Mixin
|
54
|
-
unless File.exists?(config_file = Rails.root.join('config', 'memcached.yml'))
|
55
|
-
error = "No config file found. If you used plugin version make sure you used `script/plugin install' or `rake memcached:cache_fu_install' if gem version and have memcached.yml in your config directory."
|
56
|
-
puts error
|
57
|
-
logger.error error
|
58
|
-
exit!
|
59
|
-
end
|
60
|
-
|
61
|
-
ActsAsCached.config = YAML.load(ERB.new(IO.read(config_file)).result)
|