padrino-cache 0.9.26 → 0.9.27

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.
@@ -45,7 +45,7 @@ module Padrino
45
45
  def set(key, value, opts = nil)
46
46
  if opts && opts[:expires_in]
47
47
  expires_in = opts[:expires_in].to_i
48
- expires_in = Time.new.to_i + expires_in if expires_in < EXPIRES_EDGE
48
+ expires_in = (@backend.class.name == "MemCache" ? expires_in : Time.new.to_i + expires_in) if expires_in < EXPIRES_EDGE
49
49
  @backend.set(key, value, expires_in)
50
50
  else
51
51
  @backend.set(key, value)
@@ -72,7 +72,7 @@ module Padrino
72
72
  # MyApp.cache.get('records') # => nil
73
73
  #
74
74
  def flush
75
- @backend.flush
75
+ @backend.respond_to?(:flush_all) ? @backend.flush_all : @backend.flush
76
76
  end
77
77
  end # Memcached
78
78
  end # Store
@@ -4,7 +4,7 @@ class TestPadrinoCache < Test::Unit::TestCase
4
4
 
5
5
  def teardown
6
6
  tmp = File.expand_path(File.dirname(__FILE__) + "/tmp")
7
- system("rm -rf #{tmp}")
7
+ `rm -rf #{tmp}`
8
8
  end
9
9
 
10
10
  should 'cache a fragment' do
data/test/test_stores.rb CHANGED
@@ -60,6 +60,27 @@ rescue LoadError
60
60
  warn "Skipping memcached with memcached library tests"
61
61
  end
62
62
 
63
+ begin
64
+ require 'memcache'
65
+ # we're just going to assume memcached is running on the default port
66
+ Padrino::Cache::Store::Memcache.new(::MemCache.new('127.0.0.1:11211', :exception_retry_limit => 1)).set('ping','alive')
67
+
68
+ class TestMemcacheStore < Test::Unit::TestCase
69
+ def setup
70
+ Padrino.cache = Padrino::Cache::Store::Memcache.new(::MemCache.new('127.0.0.1:11211', :exception_retry_limit => 1))
71
+ Padrino.cache.flush
72
+ end
73
+
74
+ def teardown
75
+ Padrino.cache.flush
76
+ end
77
+
78
+ eval COMMON_TESTS
79
+ end
80
+ rescue LoadError
81
+ warn "Skipping memcache with memcached library tests"
82
+ end
83
+
63
84
  begin
64
85
  require 'dalli'
65
86
  # we're just going to assume memcached is running on the default port
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-cache
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 26
10
- version: 0.9.26
9
+ - 27
10
+ version: 0.9.27
11
11
  platform: ruby
12
12
  authors:
13
13
  - Padrino Team
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2011-04-28 00:00:00 Z
21
+ date: 2011-05-06 00:00:00 Z
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
24
24
  name: padrino-core
@@ -28,12 +28,12 @@ dependencies:
28
28
  requirements:
29
29
  - - "="
30
30
  - !ruby/object:Gem::Version
31
- hash: 15
31
+ hash: 13
32
32
  segments:
33
33
  - 0
34
34
  - 9
35
- - 26
36
- version: 0.9.26
35
+ - 27
36
+ version: 0.9.27
37
37
  type: :runtime
38
38
  version_requirements: *id001
39
39
  description: Caching support for memcached, page and fragment