Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kuby-memcached

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kuby-memcached

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

kuby-memcached

Memcached plugin for Kuby.

Intro

The memcached plugin provides the ability to stand up arbitrary memcached instances. Behind the scenes it uses the excellent kubedb Kubernetes operator.

Configuration

Add the kuby-memcached gem to your Gemfile, then add a memcached instance like this:

require 'kuby/memcached'

Kuby.define(:production) do
  kubernetes do

    add_plugin(:memcached) do
      instance(:my_rails_cache)
    end

  end
end

The kuby-memcached plugin allows a number of additional configuration options too:

Kuby.define(:production) do
  kubernetes do

    add_plugin(:memcached) do
      instance(:my_rails_cache) do
        # set the version of memcached you want to use
        version '1.5.4-v1'  # this is the default version

        # set the port memcached listen on and that you'll
        # use to connect to the instance
        port 11211  # this is the default port
      end
    end

  end
end

Get a list of the memcached versions your cluster supports by running:

bundle exec kuby -e production kubectl -- get memcachedversions

Usage

Memcached instances defined in your Kuby config respond to #hostname, #port, and #url methods to help point at them in your Rails configuration. The #url method returns a complete URL to the memcached instance, including the host and port.

Rails Cache

In your Rails config (eg. config/environments/production.rb), point your cache store at your memcached instance like so:

Kuby.load!

url = Kuby.environment.kubernetes
  .plugin(:memcached)
  .instance(:my_rails_cache)
  .url

config.cache_store = :mem_cache_store, url

Dalli

You can also use a memcached client like the Dalli gem directly:

require 'dalli'

url = Kuby.environment.kubernetes
  .plugin(:memcached)
  .instance(:my_rails_cache)
  .url

dc = Dalli::Client.new(url)
dc.set('abc', 123)
value = dc.get('abc')

License

Licensed under the MIT license. See LICENSE for details.

Authors

FAQs

Package last updated on 20 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc