xbad 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/ext/xbad/xbad.c +9 -0
  3. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb7e5bad134097caa0775a4100841be7801c0089
4
- data.tar.gz: 7289023dc5afec82225737848332f6189e792915
3
+ metadata.gz: 3b040f5e82df3f21ac0c18bc8cfb6fbd8d21ce3e
4
+ data.tar.gz: 496906d81a204a7a1493a8e65bf4eb1cd9c7a4de
5
5
  SHA512:
6
- metadata.gz: bdfa4fafab6f724b0b727c50908ec11ccb217f33b18f4f4c0a1b247722549358e1a7b406c241ba7eaa47ce0293d0e02f64c435fbd38e38321e3edb1c5a628d0e
7
- data.tar.gz: cc644efaf7dc9c0c4fa2e5ed21993b2fa70c25246104a478c927ad3653ee674d2f7169e9099f54d4342ac4c33a12ff4767bffb05db9294765b9b9677c0c7f384
6
+ metadata.gz: 155170d26a537e7431b9e023e3f239c7fc681045282f35a291883f9470f039f5ff915c3b59c16a691700df4ebf58b3182591328d2554edeeca4ab0b987f35aff
7
+ data.tar.gz: e80f0b09863a03719ff46086aa7349045a4b88f239453c69eecef64e3af3f3fafae5e341ec6b6b4f3a8680363b0fdf49427ea5d906dd0845a0bd0e85ec875dcf
@@ -19,7 +19,14 @@ inline struct shared_pool *shared_pool(VALUE obj) {
19
19
  return sp;
20
20
  }
21
21
 
22
+ static inline void die_unless_string(VALUE x) {
23
+ if (TYPE(x) != T_STRING)
24
+ rb_raise(rb_eTypeError, "invalid type for input %s",rb_obj_classname(x));
25
+ }
26
+
22
27
  static VALUE XBAD_store(VALUE self, VALUE key, VALUE value, VALUE _expire_after) {
28
+ die_unless_string(key);
29
+ die_unless_string(value);
23
30
  struct shared_pool *sp = shared_pool(self);
24
31
  int expire_after = NUM2INT(_expire_after);
25
32
  if (t_add(sp,RSTRING_PTR(key),RSTRING_LEN(key),RSTRING_PTR(value),RSTRING_LEN(value),expire_after) != 0)
@@ -28,6 +35,8 @@ static VALUE XBAD_store(VALUE self, VALUE key, VALUE value, VALUE _expire_after)
28
35
  }
29
36
 
30
37
  static VALUE XBAD_store_and_broadcast(VALUE self, VALUE key, VALUE value, VALUE _expire_after,VALUE _port) {
38
+ die_unless_string(key);
39
+ die_unless_string(value);
31
40
  struct shared_pool *sp = shared_pool(self);
32
41
  int expire_after = NUM2INT(_expire_after);
33
42
  unsigned short port = NUM2INT(_port);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xbad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Borislav Nikolov
@@ -24,7 +24,8 @@ dependencies:
24
24
  - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: xbad - shared memory key/value cache..
27
+ description: xbad - shared memory key/value cache using shared memory and udp broadcasts
28
+ for distribution
28
29
  email: jack@sofialondonmoskva.com
29
30
  executables: []
30
31
  extensions:
@@ -56,5 +57,5 @@ rubyforge_project:
56
57
  rubygems_version: 2.0.3
57
58
  signing_key:
58
59
  specification_version: 4
59
- summary: xbad - shared memory key/value store
60
+ summary: xbad - shared memory key/value cache
60
61
  test_files: []