Module: ArCache

Included in:
ActiveRecord::Base
Defined in:
lib/ar_cache.rb

Overview

AR_Cache o ActiveRecord Cache Performe ActiveRecord cache in File System for heavy and repetitive query.

Author

Gianni Mazza ([email protected])

Copyright

Copyright © Redvex

License

Distributes under the same terms as Ruby

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



9
10
11
# File 'lib/ar_cache.rb', line 9

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#ensure_unique(name) ⇒ Object



13
14
15
16
17
# File 'lib/ar_cache.rb', line 13

def ensure_unique(name)
  begin
    self[name] = yield
  end while self.class.exists?(name => self[name])
end