GithubHelp home page GithubHelp logo

fredsadaghiani / dalli-elasticache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ktheory/dalli-elasticache

0.0 2.0 0.0 133 KB

A wrapper for Dalli with support for AWS ElastiCache

Ruby 100.00%

dalli-elasticache's Introduction

dalli-elasticache

A wrapper for the Dalli memcached client with support for AWS ElastiCache Auto Discovery

Installation

Install the rubygem:

# in your Gemfile
gem 'dalli-elasticache'

Usage

Using ElastiCache with Rails 3.x and newer:

# in config/environments/production.rb
elasticache = Dalli::ElastiCache.new(config_endpoint)
config.cache_store = :dalli_store, elasticache.servers, {:expires_in => 1.day, :compress => true}

Note that the ElastiCache server list will be refreshed each time an app server process starts.

General client usage:

# Create an ElastiCache instance with your config endpoint and options for Dalli
elasticache = Dalli::ElastiCache.new(config_endpoint, dalli_options={})
# For example:
elasticache = Dalli::ElastiCache.new("aaron-scratch.vfdnac.cfg.use1.cache.amazonaws.com:11211", :expires_in => 3600, :namespace => "my_app")

elasticache.version # => the config version returned by the ElastiCache config endpoint.

elasticache.servers # => array of IP addresses and hostnames, e.g. ["10.84.227.115:11211", "10.77.71.127:11211"]

client = elasticache.client # a regular Dalli::Client using the instance IP addresses returns by the config endpoint

# Check the endpoint to see if the version has changed:
elasticache.refresh.version
# If so, update your dalli client:
client = elasticache.client

License

Copyright 2013 Aaron Suggs

Released under an MIT License

dalli-elasticache's People

Contributors

ktheory avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.