cachetastic 1.5.0 → 1.6.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.
Files changed (56) hide show
  1. data/doc/classes/ActiveRecord/Base.html +188 -0
  2. data/doc/classes/CGI/Session/CachetasticStore.html +124 -0
  3. data/doc/classes/Cachetastic/Adapters/Base.html +331 -0
  4. data/doc/classes/Cachetastic/Adapters/Drb.html +332 -0
  5. data/doc/classes/Cachetastic/Adapters/File.html +248 -0
  6. data/doc/classes/Cachetastic/Adapters/FileBase.html +309 -0
  7. data/doc/classes/Cachetastic/Adapters/HtmlFile.html +224 -0
  8. data/doc/classes/Cachetastic/Adapters/LocalMemory.html +346 -0
  9. data/doc/classes/Cachetastic/Adapters/Memcache.html +498 -0
  10. data/doc/classes/Cachetastic/Cacheable.html +264 -0
  11. data/doc/classes/Cachetastic/Cacheable/ClassAndInstanceMethods.html +287 -0
  12. data/doc/classes/Cachetastic/Cacheable/ClassOnlyMethods.html +200 -0
  13. data/doc/classes/Cachetastic/Caches/Base.html +672 -0
  14. data/doc/classes/Cachetastic/Caches/Base/RegisteredCaches.html +179 -0
  15. data/doc/classes/Cachetastic/Caches/MackSessionCache.html +119 -0
  16. data/doc/classes/Cachetastic/Caches/PageCache.html +121 -0
  17. data/doc/classes/Cachetastic/Caches/RailsSessionCache.html +154 -0
  18. data/doc/classes/Cachetastic/Connection.html +212 -0
  19. data/doc/classes/Cachetastic/Errors/UnsupportedAdapter.html +146 -0
  20. data/doc/classes/Cachetastic/Logger.html +189 -0
  21. data/doc/classes/Object.html +152 -0
  22. data/doc/created.rid +1 -0
  23. data/doc/files/README.html +207 -0
  24. data/doc/files/lib/adapters/cachetastic_adapters_base_rb.html +139 -0
  25. data/doc/files/lib/adapters/cachetastic_adapters_drb_rb.html +115 -0
  26. data/doc/files/lib/adapters/cachetastic_adapters_file_base_rb.html +109 -0
  27. data/doc/files/lib/adapters/cachetastic_adapters_file_rb.html +121 -0
  28. data/doc/files/lib/adapters/cachetastic_adapters_html_file_rb.html +137 -0
  29. data/doc/files/lib/adapters/cachetastic_adapters_local_memory_rb.html +109 -0
  30. data/doc/files/lib/adapters/cachetastic_adapters_memcache_rb.html +127 -0
  31. data/doc/files/lib/adapters/cachetastic_adapters_store_object_rb.html +101 -0
  32. data/doc/files/lib/caches/cachetastic_caches_base_rb.html +108 -0
  33. data/doc/files/lib/caches/cachetastic_caches_mack_session_cache_rb.html +107 -0
  34. data/doc/files/lib/caches/cachetastic_caches_page_cache_rb.html +109 -0
  35. data/doc/files/lib/caches/cachetastic_caches_rails_session_cache_rb.html +107 -0
  36. data/doc/files/lib/cachetastic_cacheable_rb.html +101 -0
  37. data/doc/files/lib/cachetastic_connection_rb.html +107 -0
  38. data/doc/files/lib/cachetastic_logger_rb.html +107 -0
  39. data/doc/files/lib/cachetastic_rb.html +222 -0
  40. data/doc/files/lib/errors/cachetastic_errors_unsupported_adapter_rb.html +101 -0
  41. data/doc/files/lib/rails_extensions/cachetastic_active_record_base_rb.html +101 -0
  42. data/doc/files/lib/rails_extensions/cgi_session_cachetastic_store_rb.html +109 -0
  43. data/doc/files/lib/ruby_extensions/object_rb.html +101 -0
  44. data/doc/fr_class_index.html +47 -0
  45. data/doc/fr_file_index.html +47 -0
  46. data/doc/fr_method_index.html +100 -0
  47. data/doc/index.html +24 -0
  48. data/doc/rdoc-style.css +208 -0
  49. data/lib/cachetastic.rb +21 -23
  50. data/lib/cachetastic_cacheable.rb +202 -0
  51. data/lib/rails_extensions/cachetastic_active_record_base.rb +12 -39
  52. data/lib/ruby_extensions/object.rb +8 -0
  53. data/test/active_record_test.rb +8 -8
  54. data/test/cacheable_test.rb +72 -0
  55. metadata +52 -2
  56. data/lib/helpers/cachetastic_helpers_active_record.rb +0 -46
@@ -1,46 +0,0 @@
1
- module Cachetastic
2
- module Helpers
3
- # These helpers get added to ActiveRecord at both class and instance levels.
4
- module ActiveRecord
5
-
6
- # Returns the Cachetastic::Caches::Base object associated with the ActiveRecord model.
7
- # If a cache hasn't been defined the one will be created on the fly.
8
- # The cache for the ActiveRecord model is expected to be defined as:
9
- # Cachetastic::Caches::ActiveRecord::MODEL_NAME_HERE
10
- def cache_class
11
- n = self.class.name
12
- n = self.name if n == "Class"
13
- # puts "n: #{n}"
14
- c_name = "Cachetastic::Caches::ActiveRecord::#{n}Cache"
15
- unless Cachetastic::Caches::ActiveRecord.const_defined?("#{n}Cache")
16
- # puts "we need to create a cache for: #{c_name}"
17
- eval %{
18
- class #{c_name} < Cachetastic::Caches::Base
19
- end
20
- }
21
- end
22
- c_name.constantize
23
- end
24
-
25
- # How much did I want to call this method cache?? It originally was that, but
26
- # in Rails 2.0 they decided to use that name, so I had to rename this method.
27
- # This method will attempt to get an object from the cache for a given key.
28
- # If the object is nil and a block is given the block will be run, and the results
29
- # of the block will be automatically cached.
30
- def cacher(key, expiry = 0)
31
- cache_class.get(key) do
32
- if block_given?
33
- res = yield
34
- cache_class.set(key, res, expiry)
35
- end
36
- end
37
- end
38
-
39
- # Expires all the objects associated with this ActiveRecord model's cache.
40
- def expire_all
41
- cache_class.expire_all
42
- end
43
-
44
- end
45
- end
46
- end