Sha256: f225d7d91b81da949adb4c0165eb0a3b81cbe46a0dcb1f52ba0952f5e9eb1584

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

# https://www.rubydoc.info/github/mperham/dalli/Dalli/Client#set-instance_method

module Lux
  class Cache
    class MemcachedServer
      def initialize
        require 'dalli'
        @server = Dalli::Client.new('127.0.0.1:11211', { :namespace=>Digest::MD5.hexdigest(__FILE__)[0,4], :compress => true,  :expires_in => 24.hours })
      end

      def set key, data, ttl = nil
        @server.set key, data, ttl
      end

      def get key
        @server.get key
      end

      def delete key
        @server.delete key
      end

      def get_multi *args
        @server.get_multi *args
      end

      def fetch key, ttl = nil, &block
        @server.fetch key, ttl, &block
      end

      def clear
        @server.flush_all
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lux-fw-0.6.2 ./lib/lux/cache/lib/memcached_server.rb