Coder Social home page Coder Social logo

memcache_store_with_delete_groups's Introduction

MemCache Store with delete groups
================
Author: Michael Koper.

= Description
If you're using default Memcache store provided by Rails (2.1) you're probably missing functionality like delete_matched() to clear cache with Regex. This plugin is implementing some kind of feature but not with Regex but with groups. A regex solution will be very slow with a lot of requests. Because of speed reasons this plugin does not use delete_matched but delete_type. It's possible to delete groups of cache in 1 call. It's not memcache implementation but simple Ruby code to provide this functionality. This plugin is well tested on a server with more then 600 requests a minute and with 8 memcached servers combined. 

This plugin fixes the known errors like 'undefined class module ClassName' as well.

= Installation with Rails > 2.1
script/plugin install git://github.com/michaelkoper/memcache_store_with_delete_groups.git

= Usage

To fetch groups called pages:

  Rails.cache.fetch([:pages, 1], :delete_type => true) { "page 1" }
  Rails.cache.fetch([:pages, 2], :delete_type => true) { "page 2" }
  Rails.cache.fetch([:pages, 3], :delete_type => true) { "page 3" }
	
To delete all the pages:

  Rails.cache.delete_type(:pages)

= Requirements
  - Memcache
  - memcache-client gem

I stole the idea and some code from this repostiroy: git://github.com/martincik/memcache_store_with_delete_matched.git
So some credits goes to Ladislav Martincik :-)

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.