Sha256: a6a0b401da8590a6b3b3478643dc5df922ad18714012eabf01b1681c2445123b

Contents?: true

Size: 899 Bytes

Versions: 6

Compression:

Stored size: 899 Bytes

Contents

require 'familia'
require 'familia/test_helpers'
Familia.apiversion = 'v1'


## Redis Objects are unique per instance of a Familia class
@a = Bone.new 'atoken', :name1
@b = Bone.new 'atoken', :name2
@a.owners.rediskey == @b.owners.rediskey
#=> false

## Redis Objects are frozen 
@a.owners.frozen?
#=> true


## Limiter#qstamp
@limiter = Limiter.new :requests
@limiter.counter.qstamp 10.minutes, '%H:%M', 1302468980
#=> '20:50'

## Redis Objects can be stored to quantized keys
@limiter.counter.rediskey
#=> "v1:limiter:requests:counter:20:50"

## Increment counter
@limiter.counter.clear
@limiter.counter.increment
#=> 1

## Check ttl
@limiter.counter.ttl
#=> 3600

## Check ttl for a different instance
## (this exists to make sure options are cloned for each instance)
@limiter2 = Limiter.new :requests
@limiter2.counter.ttl
#=> 3600

## Check realttl
sleep 1
@limiter.counter.realttl
#=> 3600-1

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
familia-0.10.0 try/20_redis_object_try.rb
familia-0.9.3 try/20_redis_object_try.rb
familia-0.9.2 try/20_redis_object_try.rb
familia-0.9.1 try/20_redis_object_try.rb
familia-0.9.0 try/20_redis_object_try.rb
familia-0.7.1 try/20_redis_object_try.rb