Sha256: a1a74708d811d5564ac5c2d2d17ac7a31a2a66860c5adac6a48a083db04f00cc

Contents?: true

Size: 1.25 KB

Versions: 18

Compression:

Stored size: 1.25 KB

Contents

#          Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'spec/helper'
spec_require 'sequel'

DB = Sequel.sqlite

describe Ramaze::Cache::Sequel do
  Ramaze.options.cache.names = [:one, :two]
  Ramaze.options.cache.default = Ramaze::Cache::Sequel
  Ramaze.setup_dependencies

  cache = Ramaze::Cache.one
  hello = 'Hello, World!'

  should 'store without ttl' do
    cache.store(:hello, hello).should == hello
  end

  should 'fetch' do
    cache.fetch(:hello).should == hello
  end

  should 'delete' do
    cache.delete(:hello)
    cache.fetch(:hello).should == nil
  end

  should 'delete two key/value pairs at once' do
    cache.store(:hello, hello).should == hello
    cache.store(:ramaze, 'ramaze').should == 'ramaze'
    cache.delete(:hello, :ramaze)
    cache.fetch(:hello).should == nil
    cache.fetch(:innate).should == nil
  end

  should 'store with ttl' do
    cache.store(:hello, @hello, :ttl => 0.2)
    cache.fetch(:hello).should == @hello
    sleep 0.3
    cache.fetch(:hello).should == nil
  end

  should 'clear' do
    cache.store(:hello, @hello)
    cache.fetch(:hello).should == @hello
    cache.clear
    cache.fetch(:hello).should == nil
  end
end

Version data entries

18 entries across 18 versions & 4 rubygems

Version Path
Pistos-ramaze-2009.04.08 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.04.01 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.04.08 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.04.18 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.04.22 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.04 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.05.08 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.05 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.06.04 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.06.12 spec/ramaze/cache/sequel.rb
manveru-ramaze-2009.06 spec/ramaze/cache/sequel.rb
rjspotter-ramaze-2009.06.29 spec/ramaze/cache/sequel.rb
rjspotter-ramaze-2009.06.31 spec/ramaze/cache/sequel.rb
ramaze-2009.04 spec/ramaze/cache/sequel.rb
ramaze-2009.05 spec/ramaze/cache/sequel.rb
ramaze-2009.06 spec/ramaze/cache/sequel.rb
ramaze-2009.06.12 spec/ramaze/cache/sequel.rb
ramaze-2009.06.04 spec/ramaze/cache/sequel.rb