lawnchair 0.5.7 → 0.6.0

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.7
1
+ 0.6.0
data/lawnchair.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{lawnchair}
8
- s.version = "0.5.7"
8
+ s.version = "0.6.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Shane Wolf"]
12
- s.date = %q{2010-03-24}
12
+ s.date = %q{2010-05-19}
13
13
  s.description = %q{Fully featured caching mechanism for arbitrary pieces of resource expensive ruby code using Redis while being able to optionally store data in the Ruby process itself for maximum efficiency.}
14
14
  s.email = %q{shanewolf@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,7 @@ module Lawnchair
32
32
 
33
33
  def computed_key(key)
34
34
  raise "Missing key" if key.nil? || key.empty?
35
- raise "Key's may not contain whitespace" if key.match(/\s/)
35
+ key.gsub!(" ","") if key.match(/\s/)
36
36
  prefix = "Lawnchair"
37
37
  "#{prefix}:#{key}"
38
38
  end
@@ -9,12 +9,11 @@ module Lawnchair
9
9
  end
10
10
 
11
11
  def set(key, value, options={})
12
- ttl = options[:expires_in] || 3600
13
- if options[:raw]
14
- data_store.set(computed_key(key), value, ttl)
15
- else
16
- data_store.set(computed_key(key), Marshal.dump(value), ttl)
17
- end
12
+ ttl = options[:expires_in] || 3600
13
+ value = Marshal.dump(value) unless options[:raw]
14
+
15
+ data_store.set(computed_key(key), value)
16
+ data_store.expireat(computed_key(key), Time.now.to_i + ttl)
18
17
  end
19
18
 
20
19
  def exists?(key)
@@ -91,10 +91,8 @@ describe "Lawnchair::StorageEngine::Abstract" do
91
91
  abstract_store.computed_key("hooo").should == "Lawnchair:hooo"
92
92
  end
93
93
 
94
- it "raises an exception if a key has a space" do
95
- lambda do
96
- abstract_store.computed_key("hooo tyyyyy")
97
- end.should raise_error
94
+ it "removes whitespace that might exist in a key" do
95
+ abstract_store.computed_key("hooo tyyyyy").should == "Lawnchair:hoootyyyyy"
98
96
  end
99
97
 
100
98
  it "raises an exception if no key is given" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lawnchair
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.7
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Wolf
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-24 00:00:00 -07:00
12
+ date: 2010-05-19 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency