cache_store 0.1.0 → 0.1.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: 06d887fb2a9be3c965f80c4abcf44b20880ec695
4
- data.tar.gz: b28e631bb46f71a12585691c737993392d7e9dd9
3
+ metadata.gz: 5dc239d2d8d6b832f63b25854dc9009af6ed78d1
4
+ data.tar.gz: d6a52f7295ca4c87f8df7c087970d41aa4e89365
5
5
  SHA512:
6
- metadata.gz: 0c22390d96e6d7fedd435ef3dadd7fefa9e7c1c5f78a0690a9ce97f28aa7cc0e31ca881fbcfe517eb35b1096606842b7532c1a1f4b5bba7e12316c789b34aa2a
7
- data.tar.gz: 81a277cb0784b3e17b39d88f43dcd22ece0cfab5b48bd679bf9bc98c42c3663c02185f33fa4deff1fc54d6a5a22f385ecff2e95e61e45a4a1b0b78162f74fbfd
6
+ metadata.gz: 911a9b82aeaabced69dff80b7413f2b2d491f6928db7e4930b9a4c5e06c4505dc5aeb27fe9dce6c3d27f3591bb037e11bc7bc6f440409f2bd0e3ed5d03034c58
7
+ data.tar.gz: cf5487f8bb0e3e92b5129ef9061365c882f7a03aaa72581b3084b4da754a08a7bdcf72334680ded5e5f88e1f3203d87bde8f269eb41643e94cbd7f9e00dd8b1f
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in cache_store.gemspec
4
4
  gemspec
5
-
6
- gem 'pry'
@@ -1,3 +1,3 @@
1
1
  module CacheStore
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/cache_store.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "cache_store/version"
2
2
  require 'date'
3
- require 'pry'
4
3
  #This class is used to define the contract that CacheStore implementations must adhere to.
5
4
  class CacheStoreContract
6
5
 
@@ -53,9 +52,9 @@ class LocalCacheStore
53
52
 
54
53
  #This method is called to set a value within this cache store by it's key.
55
54
  #
56
- # @param [String] This is the unique key to reference the value being set within this cache store.
57
- # @param [Object] This is the value to set within this cache store.
58
- # @param [Integer] This is the number of seconds from the current time that this value should expire.
55
+ # @param key [String] This is the unique key to reference the value being set within this cache store.
56
+ # @param value [Object] This is the value to set within this cache store.
57
+ # @param expires_in [Integer] This is the number of seconds from the current time that this value should expire.
59
58
  def set(key, value, expires_in = 0)
60
59
  remove(build_key(key))
61
60
  expires = nil
@@ -68,9 +67,10 @@ class LocalCacheStore
68
67
 
69
68
  #This method is called to get a value from this cache store by it's unique key.
70
69
  #
71
- # @param [String] This is the unique key to reference the value to fetch from within this cache store.
72
- # @param [Integer] This is the number of seconds from the current time that this value should expire. (This is used in conjunction with the block to hydrate the cache key if it is empty.)
73
- # @param [Block] This block is provided to hydrate this cache store with the value for the request key when it is not found.
70
+ # @param key [String] This is the unique key to reference the value to fetch from within this cache store.
71
+ # @param expires_in [Integer] This is the number of seconds from the current time that this value should expire. (This is used in conjunction with the block to hydrate the cache key if it is empty.)
72
+ # @param &block [Block] This block is provided to hydrate this cache store with the value for the request key when it is not found.
73
+ # @return [Object] The value for the specified unique key within the cache store.
74
74
  def get(key, expires_in = 0, &block)
75
75
 
76
76
  #look for the cache item in the store
@@ -103,14 +103,15 @@ class LocalCacheStore
103
103
 
104
104
  # This method is called to remove a value from this cache store by it's unique key.
105
105
  #
106
- # @param [String] This is the unique key to reference the value to remove from this cache store.
106
+ # @param key [String] This is the unique key to reference the value to remove from this cache store.
107
107
  def remove(key)
108
108
  @store.delete_if { |i| i[:key] == build_key(key) }
109
109
  end
110
110
 
111
111
  # This method is called to check if a value exists within this cache store for a specific key.
112
112
  #
113
- # @param [String] This is the unique key to reference the value to check for within this cache store.
113
+ # @param key [String] This is the unique key to reference the value to check for within this cache store.
114
+ # @return [Boolean] True or False to specify if the key exists in the cache store.
114
115
  def exist?(key)
115
116
  !@store.select { |i| i[:key] == build_key(key) }.empty?
116
117
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cache_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-02-22 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler