ashleym1972-cache-money 0.2.5.1 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/init.rb +1 -0
  2. data/rails/init.rb +36 -0
  3. metadata +3 -1
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.join(File.basedir(__FILE__),'rails','init')
data/rails/init.rb ADDED
@@ -0,0 +1,36 @@
1
+ yml = YAML.load(IO.read(File.join(RAILS_ROOT, "config", "memcached.yml")))
2
+ memcache_config = yml[RAILS_ENV]
3
+ memcache_config.symbolize_keys!
4
+
5
+ if memcache_config.nil? || memcache_config[:cache_money].nil?
6
+ class ActiveRecord::Base
7
+ def self.index(*args)
8
+ end
9
+ end
10
+ else
11
+ require 'cache_money'
12
+
13
+ ##$memcache = Rails.cache
14
+ memcache_config[:logger] = Rails.logger
15
+ $memcache = MemCache.new(memcache_config[:servers], memcache_config)
16
+
17
+ ActionController::Base.cache_store = :cache_money_mem_cache_store
18
+ ActionController::Base.session_options[:cache] = $memcache if memcache_options[:sessions]
19
+ silence_warnings { Object.const_set "RAILS_CACHE", ActiveSupport::Cache.lookup_store(:cache_money_mem_cache_store) }
20
+
21
+ $local = Cash::Local.new($memcache)
22
+ $lock = Cash::Lock.new($memcache)
23
+ $cache = Cash::Transactional.new($local, $lock)
24
+
25
+ class ActiveRecord::Base
26
+ is_cached(:repository => $cache)
27
+
28
+ def <=>(other)
29
+ if self.id == other.id then
30
+ 0
31
+ else
32
+ self.id < other.id ? -1 : 1
33
+ end
34
+ end
35
+ end
36
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ashleym1972-cache-money
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5.1
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Kallen
@@ -72,6 +72,8 @@ files:
72
72
  - lib/cash/util/marshal.rb
73
73
  - lib/cash/write_through.rb
74
74
  - lib/cache_money.rb
75
+ - rails/init.rb
76
+ - init.rb
75
77
  has_rdoc: false
76
78
  homepage: http://github.com/ashleym1972/cache-money
77
79
  licenses: