cachetastic-three 3.0.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.
- data/LICENSE +21 -0
- data/README +89 -0
- data/doc/classes/Cachetastic/Adapters.html +180 -0
- data/doc/classes/Cachetastic/Adapters/Base.html +419 -0
- data/doc/classes/Cachetastic/Adapters/File.html +135 -0
- data/doc/classes/Cachetastic/Adapters/LocalMemory.html +125 -0
- data/doc/classes/Cachetastic/Adapters/Memcached.html +193 -0
- data/doc/classes/Cachetastic/Cache.html +425 -0
- data/doc/classes/Cachetastic/Cacheable.html +255 -0
- data/doc/classes/Cachetastic/Cacheable/ClassAndInstanceMethods.html +290 -0
- data/doc/classes/Cachetastic/Cacheable/ClassOnlyMethods.html +197 -0
- data/doc/classes/Cachetastic/Logger.html +186 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +132 -0
- data/doc/files/README.html +222 -0
- data/doc/files/lib/cachetastic/adapters/base_rb.html +101 -0
- data/doc/files/lib/cachetastic/adapters/file_rb.html +101 -0
- data/doc/files/lib/cachetastic/adapters/local_memory_rb.html +101 -0
- data/doc/files/lib/cachetastic/adapters/memcached_rb.html +101 -0
- data/doc/files/lib/cachetastic/cache_rb.html +101 -0
- data/doc/files/lib/cachetastic/cacheable_rb.html +101 -0
- data/doc/files/lib/cachetastic/extensions/string_rb.html +108 -0
- data/doc/files/lib/cachetastic/logger_rb.html +101 -0
- data/doc/files/lib/cachetastic/store_object_rb.html +101 -0
- data/doc/files/lib/cachetastic_rb.html +112 -0
- data/doc/fr_class_index.html +36 -0
- data/doc/fr_file_index.html +38 -0
- data/doc/fr_method_index.html +52 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/cachetastic.rb +20 -0
- data/lib/cachetastic/adapters/base.rb +178 -0
- data/lib/cachetastic/adapters/file.rb +66 -0
- data/lib/cachetastic/adapters/local_memory.rb +37 -0
- data/lib/cachetastic/adapters/memcached.rb +114 -0
- data/lib/cachetastic/cache.rb +165 -0
- data/lib/cachetastic/cacheable.rb +202 -0
- data/lib/cachetastic/extensions/string.rb +8 -0
- data/lib/cachetastic/logger.rb +49 -0
- data/lib/cachetastic/store_object.rb +22 -0
- metadata +122 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
module Cachetastic # :nodoc:
|
2
|
+
# This class handles logging for the caches and their adapters.
|
3
|
+
# This class exists simply to supply the ability to write to
|
4
|
+
# multiple loggers simultaneously from a single call. It also
|
5
|
+
# creates a standardized message to write to those loggers.
|
6
|
+
#
|
7
|
+
# It is important that any logger type of class you decide to use
|
8
|
+
# reponds to the following methods:
|
9
|
+
# fatal(message)
|
10
|
+
# error(message)
|
11
|
+
# warn(message)
|
12
|
+
# info(message)
|
13
|
+
# debug(message)
|
14
|
+
class Logger
|
15
|
+
|
16
|
+
# An <tt>Array</tt> of 'real' loggers to write to.
|
17
|
+
attr_accessor :loggers
|
18
|
+
|
19
|
+
# The <tt>initialize</tt> method takes an <tt>Array</tt>
|
20
|
+
# of your favorite logger style classes to write to.
|
21
|
+
def initialize(*loggers)
|
22
|
+
@loggers = [loggers].flatten
|
23
|
+
end
|
24
|
+
|
25
|
+
LOG_LEVELS = [:fatal, :error, :warn, :info, :debug] # :nodoc:
|
26
|
+
|
27
|
+
LOG_LEVELS.each do |level|
|
28
|
+
define_method(level) do |*args|
|
29
|
+
lm = "[CACHE] [#{level.to_s.upcase}]\t#{Time.now.strftime("%m/%d/%y %H:%M:%S")}"
|
30
|
+
exs = []
|
31
|
+
args.each do |arg|
|
32
|
+
if arg.is_a?(Exception)
|
33
|
+
exs << arg
|
34
|
+
continue
|
35
|
+
end
|
36
|
+
lm << "\t" << arg.to_s
|
37
|
+
end
|
38
|
+
exs.each do |ex|
|
39
|
+
lm << "\n#{ex.message}\n" << ex.backtrace.join("\n")
|
40
|
+
end
|
41
|
+
# puts "lm: #{lm}"
|
42
|
+
self.loggers.each do |log|
|
43
|
+
log.send(level, lm)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end # Logger
|
49
|
+
end # Cachetastic
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Cachetastic # :nodoc:
|
2
|
+
class Cache
|
3
|
+
|
4
|
+
class StoreObject # :nodoc:
|
5
|
+
attr_accessor :expires_at
|
6
|
+
attr_accessor :key
|
7
|
+
attr_accessor :value
|
8
|
+
|
9
|
+
def initialize(key, value, expires_at)
|
10
|
+
self.key = key
|
11
|
+
self.value = value
|
12
|
+
self.expires_at = expires_at
|
13
|
+
end
|
14
|
+
|
15
|
+
def expired?
|
16
|
+
return Time.now > self.expires_at
|
17
|
+
end
|
18
|
+
|
19
|
+
end # StoreObject
|
20
|
+
|
21
|
+
end # Cache
|
22
|
+
end # Cachetastic
|
metadata
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cachetastic-three
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mark Bates
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-06-11 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: configatron
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.2
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: memcache-client
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.7.4
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: activesupport
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 2.3.2
|
44
|
+
version:
|
45
|
+
description: A very simple, yet very powerful caching framework for Ruby.
|
46
|
+
email: mark@mackframework.com
|
47
|
+
executables: []
|
48
|
+
|
49
|
+
extensions: []
|
50
|
+
|
51
|
+
extra_rdoc_files:
|
52
|
+
- README
|
53
|
+
- LICENSE
|
54
|
+
files:
|
55
|
+
- lib/cachetastic/adapters/base.rb
|
56
|
+
- lib/cachetastic/adapters/file.rb
|
57
|
+
- lib/cachetastic/adapters/local_memory.rb
|
58
|
+
- lib/cachetastic/adapters/memcached.rb
|
59
|
+
- lib/cachetastic/cache.rb
|
60
|
+
- lib/cachetastic/cacheable.rb
|
61
|
+
- lib/cachetastic/extensions/string.rb
|
62
|
+
- lib/cachetastic/logger.rb
|
63
|
+
- lib/cachetastic/store_object.rb
|
64
|
+
- lib/cachetastic.rb
|
65
|
+
- README
|
66
|
+
- LICENSE
|
67
|
+
- doc/classes/Cachetastic/Adapters/Base.html
|
68
|
+
- doc/classes/Cachetastic/Adapters/File.html
|
69
|
+
- doc/classes/Cachetastic/Adapters/LocalMemory.html
|
70
|
+
- doc/classes/Cachetastic/Adapters/Memcached.html
|
71
|
+
- doc/classes/Cachetastic/Adapters.html
|
72
|
+
- doc/classes/Cachetastic/Cache.html
|
73
|
+
- doc/classes/Cachetastic/Cacheable/ClassAndInstanceMethods.html
|
74
|
+
- doc/classes/Cachetastic/Cacheable/ClassOnlyMethods.html
|
75
|
+
- doc/classes/Cachetastic/Cacheable.html
|
76
|
+
- doc/classes/Cachetastic/Logger.html
|
77
|
+
- doc/created.rid
|
78
|
+
- doc/files/lib/cachetastic/adapters/base_rb.html
|
79
|
+
- doc/files/lib/cachetastic/adapters/file_rb.html
|
80
|
+
- doc/files/lib/cachetastic/adapters/local_memory_rb.html
|
81
|
+
- doc/files/lib/cachetastic/adapters/memcached_rb.html
|
82
|
+
- doc/files/lib/cachetastic/cache_rb.html
|
83
|
+
- doc/files/lib/cachetastic/cacheable_rb.html
|
84
|
+
- doc/files/lib/cachetastic/extensions/string_rb.html
|
85
|
+
- doc/files/lib/cachetastic/logger_rb.html
|
86
|
+
- doc/files/lib/cachetastic/store_object_rb.html
|
87
|
+
- doc/files/lib/cachetastic_rb.html
|
88
|
+
- doc/files/LICENSE.html
|
89
|
+
- doc/files/README.html
|
90
|
+
- doc/fr_class_index.html
|
91
|
+
- doc/fr_file_index.html
|
92
|
+
- doc/fr_method_index.html
|
93
|
+
- doc/index.html
|
94
|
+
- doc/rdoc-style.css
|
95
|
+
has_rdoc: true
|
96
|
+
homepage: http://www.metabates.com
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: "0"
|
107
|
+
version:
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: "0"
|
113
|
+
version:
|
114
|
+
requirements: []
|
115
|
+
|
116
|
+
rubyforge_project: magrathea
|
117
|
+
rubygems_version: 1.3.1
|
118
|
+
signing_key:
|
119
|
+
specification_version: 2
|
120
|
+
summary: A very simple, yet very powerful caching framework for Ruby.
|
121
|
+
test_files: []
|
122
|
+
|