canery 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Canery
2
- Canery is a simple and easy to use key/value store with several commands to store and retrieve data. As the backend uses [Sequel](https://github.com/jeremyevans/sequel/) for persistence, Canery can be used in virtually any environment where a SQL database is available. (For more information please check out the section with the available database adapters.)
2
+ Canery is a simple and easy to use key/value store with several commands to store and retrieve data. As the backend uses [Sequel](https://github.com/jeremyevans/sequel/) for persistence, Canery can be used in virtually any environment where a SQL database is available. (For more information please check out the section in the Sequel documentation with the available database adapters.)
3
3
 
4
4
  ## Installation
5
5
  gem install canery
@@ -32,6 +32,8 @@ Canery provides a simple and understandable API which is a bit inspired by Redis
32
32
 
33
33
  For more information consider the wiki. (Comming soon... I promise!)
34
34
 
35
+ ## Performance
36
+ Due to the nature of SQL databases it's (almost) impossible for Canery to be as fast as well-known NoSQL key/value stores like Kyoto Cabinet, LevelDB or Redis. But for environments where NoSQL databases are not available or just for small Web Applications you should give Canery a try.
35
37
 
36
38
  ## Information about data types
37
39
  ### Keys & Tub names
@@ -71,7 +71,14 @@ module Canery
71
71
 
72
72
  def mset(name, data)
73
73
  raise ArgumentError, "data must be a Hash with keys and values" unless Hash === data
74
- namespace(name).multi_insert(data.map{ |key, value| {:key => build_key(key), :value => dump(value)} }) && "OK"
74
+ begin
75
+ namespace(name).multi_insert(data.map{ |key, value| {:key => build_key(key), :value => dump(value)} }) && "OK"
76
+ rescue
77
+ # Fallback to the slower update method
78
+ data.each do |key, value|
79
+ update(name, key, value)
80
+ end && "OK"
81
+ end
75
82
  end
76
83
 
77
84
  def delete(name, key)
@@ -139,7 +146,7 @@ module Canery
139
146
  end
140
147
 
141
148
  def build_key(key)
142
- key.strip.to_s
149
+ key.to_s.strip
143
150
  end
144
151
 
145
152
  def basic_tub_name(name)
@@ -52,7 +52,7 @@ module Canery
52
52
  end
53
53
 
54
54
  def tub_name(name)
55
- name.strip.to_s
55
+ name.to_s.strip
56
56
  end
57
57
 
58
58
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Canery
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -94,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: 1448134427803613002
97
+ hash: -281279343697412722
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  none: false
100
100
  requirements:
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  version: '0'
104
104
  segments:
105
105
  - 0
106
- hash: 1448134427803613002
106
+ hash: -281279343697412722
107
107
  requirements: []
108
108
  rubyforge_project:
109
109
  rubygems_version: 1.8.24