libcache 0.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e8612eef2a81c246498e1754292a22ae0f4dbda6
4
- data.tar.gz: 7cc008ff91ef841e8a98d9a9113616f31047aca4
3
+ metadata.gz: cd7de71e70376b7fddaf6082f9136bc66e98e3e6
4
+ data.tar.gz: c349e392443f65fa59c5c55259af48c8afd10eec
5
5
  SHA512:
6
- metadata.gz: c79778ceb2c0c8e2ef1c29df41e6cf1ec9941d09624f0a884eb70c81d3dea2ebd039d4f271197b22d1fab71628f7221ce9f58d27c2f915e04f5e436440a4a038
7
- data.tar.gz: 1b0d07b38f7926a47dffa619ea2232d4f7c87a5146d16d101fe533477e91cb0457d7f2aefcbed57724dbdf47e149c8732bbfd7e1e9136bc56d977445ae254505
6
+ metadata.gz: 6bc46327213cb45af8cd9890402e1936e7be7771b9f405cfb0693e91263c8815cef38df31e4f08af956bb7536a942e641d5982c0516d9a09be7296861642f7ac
7
+ data.tar.gz: a96427c27f0a4ae159be068a1b76636da792096b77bc48b731d9a72896cd1c75e9713090c54fd00d7a91a23e02c3651a84997ad97d5c88e9bae20b07a32e624d
data/README.md CHANGED
@@ -40,6 +40,9 @@ sleep 4 # note that this is more than the expiry time
40
40
  cache.get(1) # will return 105 as the data has been refreshed
41
41
  cache.exists?(1) # will return true. if there is no set_refresh method provided then it will return false
42
42
 
43
+ cache.put("key123", [1,2,true])
44
+ pp cache.get("key123") # prints '[1, 2, true]' preserves type
45
+
43
46
  # delete all data on exit of program
44
47
  at_exit do
45
48
  cache.invalidate_all
@@ -57,6 +60,8 @@ sleep 4 # note that this is more than the expiry time
57
60
  cache.get(1) # will return 105 as the data has been refreshed
58
61
  cache.exists?(1) # will return true. if there is no set_refresh method provided then it will return false
59
62
 
63
+ cache.put("key123", [1,2,true])
64
+ pp cache.get("key123") # prints '[1, 2, true]' preserves type
60
65
 
61
66
  # delete all leftover files on exit of program
62
67
  at_exit do
@@ -21,8 +21,8 @@ class FileCache < Cache
21
21
  # @param [String] key The key value used to identify an object in the cache
22
22
  # @param [Object] value The object to be placed in the cache
23
23
  def put(key, value)
24
- raise InvalidKey unless key.is_a? String
25
- raise InvalidKey unless key =~ /\A[a-zA-Z0-9_-]+\z/
24
+ raise ArgumentError unless key.is_a? String
25
+ raise ArgumentError unless key =~ /\A[a-zA-Z0-9_-]+\z/
26
26
  @keys[key] = @keys.size.to_s
27
27
  File.open(File.join(store, @keys[key]), 'w') do |f|
28
28
  f.write(Marshal.dump(value))
@@ -1,3 +1,3 @@
1
1
  module Libcache
2
- VERSION = "0.4"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libcache
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - silk8192