# File lib/ramaze/cache/sequel.rb, line 271
      def cache_store(key, value, options = {})
        nkey = namespaced(key)

        # Get the time after which the cache should be expired
        if options[:ttl]
          ttl = options[:ttl]
        else
          ttl = Ramaze::Cache::Sequel.options[:ttl]
        end

        expires = Time.now + ttl if ttl

        # The row already exists, update it.
        if @dataset.filter(:key => nkey).count == 1
          serialized_value = serialize(value)

          if serialized_value
            @dataset.update(:value => serialize(value), :expires => expires)
          end
        # The row doesn't exist yet.
        else
          serialized_value = serialize(value)

          if serialized_value
            @dataset.insert(
              :key => nkey, :value => serialize(value), :expires => expires
            )
          end
        end

        # Try to deserialize the value. If this fails we'll return a different
        # value
        deserialized = deserialize(@dataset.select(:value) \
          .filter(:key => nkey) \
          .limit(1).first[:value])

        if deserialized
          return deserialized
        else
          return value
        end
      end