localmemcache_store 0.0.4 → 0.0.5

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.
@@ -89,5 +89,13 @@ module ActiveSupport::Cache
89
89
  def clear
90
90
  @lmc.clear
91
91
  end
92
+
93
+ # Returns the status of the cache in form of a hash. Elements are:
94
+ # +:free_bytes+, +:used_bytes+, +:total_bytes+ and +:usage+
95
+ def status
96
+ s = @lmc.hash.shm_status
97
+ s[:usage] = s[:used_bytes].to_f / s[:total_bytes].to_f
98
+ s
99
+ end
92
100
  end
93
101
  end
@@ -56,4 +56,20 @@ class LocalmemcacheStoreTest < ActiveSupport::TestCase
56
56
  assert result
57
57
  end
58
58
 
59
+ test "has status" do
60
+ assert_not_nil @cache.status
61
+ end
62
+ test "status has free_bytes" do
63
+ assert_not_nil @cache.status[:free_bytes]
64
+ end
65
+ test "status has used_bytes" do
66
+ assert_not_nil @cache.status[:used_bytes]
67
+ end
68
+ test "status has total_bytes" do
69
+ assert_not_nil @cache.status[:total_bytes]
70
+ end
71
+ test "status has usage" do
72
+ assert_not_nil @cache.status[:usage]
73
+ end
74
+
59
75
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localmemcache_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Florian D\xC3\xBCtsch (der_flo)"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-27 00:00:00 +01:00
12
+ date: 2009-11-01 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency