Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated gems and added reload method to refresh cache info.

  • Loading branch information...
commit 60648929de81b098e46eac862bdfa78454c8c7c3 1 parent f5d02a2
Travis Reeder treeder authored
1  Gemfile
... ... @@ -1,4 +1,3 @@
1   -# A sample Gemfile
2 1 source "https://rubygems.org"
3 2
4 3 gemspec
12 Gemfile.lock
... ... @@ -1,26 +1,26 @@
1 1 PATH
2 2 remote: .
3 3 specs:
4   - iron_cache (1.2.0)
  4 + iron_cache (1.2.1)
5 5 iron_core (>= 0.4.2)
6 6
7 7 GEM
8 8 remote: https://rubygems.org/
9 9 specs:
10   - iron_core (0.4.2)
  10 + iron_core (0.4.3)
11 11 rest (>= 2.0.2)
12 12 memcache-client (1.8.5)
13 13 mime-types (1.19)
14   - minitest (3.3.0)
  14 + minitest (4.1.0)
15 15 net-http-persistent (2.7)
16 16 rake (0.9.2.2)
17   - rest (2.0.2)
  17 + rest (2.0.4)
18 18 net-http-persistent
19 19 rest-client (>= 0.3.0)
20 20 rest-client (1.6.7)
21 21 mime-types (>= 1.16)
22   - test-unit (2.5.1)
23   - uber_config (0.0.6)
  22 + test-unit (2.5.2)
  23 + uber_config (1.0.5)
24 24
25 25 PLATFORMS
26 26 ruby
4 lib/iron_cache/caches.rb
@@ -76,6 +76,10 @@ def load_cache
76 76 q
77 77 end
78 78
  79 + def reload
  80 + load_cache
  81 + end
  82 +
79 83 def size
80 84 return raw["size"] if raw["size"]
81 85 return @size if @size
57 test/load_er_up.rb
... ... @@ -0,0 +1,57 @@
  1 +require_relative 'test_base'
  2 +
  3 +class QuickRun < TestBase
  4 +
  5 + def setup
  6 + super
  7 + end
  8 +
  9 + #def test_loader
  10 + # cache_name = 'ironcache-load'
  11 + # cache = @client.cache(cache_name)
  12 + # p cache
  13 + # 100.times do |i|
  14 + # p i
  15 + # key = "x"
  16 + # value = "hello world!"
  17 + # res = cache.put(key, value)
  18 + # p res
  19 + # assert res.msg
  20 + # end
  21 + #
  22 + # cache.reload
  23 + # puts "size: #{cache.size}"
  24 + # assert_equal 100, cache.size
  25 + #
  26 + #end
  27 +
  28 + def test_unloader
  29 + cache_name = 'ironcache-load'
  30 + cache = @client.cache(cache_name)
  31 + p cache
  32 + assert_equal 201, cache.size
  33 + res = cache.get("x")
  34 + p res
  35 + value = "hello world!"
  36 + assert_equal value, res.value
  37 +
  38 + 100.times do |i|
  39 + p i
  40 + key = "x#{i}"
  41 + res = cache.put(key, value)
  42 + #p res
  43 + assert res.msg
  44 + end
  45 +
  46 + cache.reload
  47 + puts "size: #{cache.size}"
  48 + assert_equal 201, cache.size
  49 +
  50 + res = cache.put("randomyo", value)
  51 + assert_equal 202, cache.reload.size
  52 +
  53 + end
  54 +
  55 +
  56 +end
  57 +
21 test/quick_run.rb
@@ -4,29 +4,36 @@ class QuickRun < TestBase
4 4
5 5 def setup
6 6 super
7   - @client.cache_name = 'ironcache-gem-quick'
8 7 end
9 8
10 9 def test_basics
  10 + cache_name = 'ironcache-gem-quick'
  11 + cache = @client.cache(cache_name)
  12 + p cache
11 13 key = "x"
12 14 value = "hello world!"
13   - res = @client.items.put(key, value)
  15 + res = cache.put(key, value)
14 16 p res
15 17 assert res.msg
  18 + puts "size: #{cache.size}"
  19 + assert_equal 1, cache.size
16 20
17   - res = @client.items.get(key)
18   - assert res.value
19   - assert res.value == value
  21 + res = cache.get(key)
20 22 p res
  23 + assert_equal value, res.value
21 24
22   - res = @client.items.delete(key)
  25 + res = cache.delete(key)
23 26 p res
24 27 assert res.msg
25 28
26   - res = @client.items.get(key)
  29 + res = cache.get(key)
27 30 p res
28 31 assert res.nil?
29 32
  33 + cache.reload
  34 + puts "size: #{cache.size}"
  35 + assert_equal 0, cache.size
  36 +
30 37 end
31 38
32 39

0 comments on commit 6064892

Please sign in to comment.
Something went wrong with that request. Please try again.