big_cache 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +3 -2
- data/lib/big_cache.rb +8 -8
- metadata +2 -2
data/README.txt
CHANGED
@@ -16,11 +16,12 @@ Infinite size, persistent cache using Amazon S3 for storage.
|
|
16
16
|
|
17
17
|
== REQUIREMENTS:
|
18
18
|
|
19
|
-
|
19
|
+
activesupport
|
20
|
+
right_aws
|
20
21
|
|
21
22
|
== INSTALL:
|
22
23
|
|
23
|
-
|
24
|
+
sudo gem install big_cache
|
24
25
|
|
25
26
|
== LICENSE:
|
26
27
|
|
data/lib/big_cache.rb
CHANGED
@@ -6,10 +6,10 @@ module ActiveSupport
|
|
6
6
|
|
7
7
|
class BigCache < Store
|
8
8
|
|
9
|
-
VERSION = '1.0.
|
9
|
+
VERSION = '1.0.1'
|
10
10
|
def initialize(bucket_name, access_key, secret_key)
|
11
11
|
puts 'Creating new BigCache'
|
12
|
-
@s3 = RightAws::S3.new(access_key, secret_key)
|
12
|
+
@s3 = RightAws::S3.new(access_key, secret_key, {:multi_thread => false, :protocol => "http", :port => 80})
|
13
13
|
@bucket = @s3.bucket(bucket_name, true)
|
14
14
|
|
15
15
|
end
|
@@ -22,11 +22,11 @@ module ActiveSupport
|
|
22
22
|
return nil
|
23
23
|
end
|
24
24
|
cache_entry = key.data
|
25
|
-
puts 'cache_entry=' + cache_entry
|
25
|
+
# puts 'cache_entry=' + cache_entry
|
26
26
|
index = cache_entry.index('::')
|
27
|
-
|
27
|
+
# puts 'index=' + index.to_s
|
28
28
|
expires = cache_entry[0..index].to_i
|
29
|
-
|
29
|
+
# puts 'expires in get=' + expires.to_s
|
30
30
|
expires2 = (expires - Time.now.to_i)
|
31
31
|
if expires2 > 0
|
32
32
|
# puts 'returning from cache ' + @cache[key][1].inspect
|
@@ -38,9 +38,9 @@ module ActiveSupport
|
|
38
38
|
return nil
|
39
39
|
end
|
40
40
|
|
41
|
-
def put(key, val, seconds_to_store)
|
42
|
-
seconds_to_store = seconds_to_store || 9999999
|
43
|
-
|
41
|
+
def put(key, val, seconds_to_store=9999999)
|
42
|
+
# seconds_to_store = seconds_to_store || 9999999
|
43
|
+
# puts 'seconds=' + seconds_to_store.to_s
|
44
44
|
data = Marshal.dump(val)
|
45
45
|
@bucket.put(key, (Time.now+seconds_to_store).to_i.to_s + "::" + data)
|
46
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: big_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Reeder
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-21 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|