GithubHelp home page GithubHelp logo

rafaelss / sinatra-memcache Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gioext/sinatra-memcache

1.0 2.0 0.0 100 KB

fragment cache on Sinatra

Home Page: http://d.hatena.ne.jp/gioext

Ruby 100.00%

sinatra-memcache's Introduction

Sinatra-MemCache

Dependencies

memcache-client

zlib

Install

sudo gem install gioext-sinatra-memcache

Example

require 'rubygems'
require 'sinatra'
require 'sinatra/memcache'

# cache
get '/cache1' do
  cache 'cache1' do
    sleep(5)
    'Hello Cache1'
  end
end

# args
get '/cache2' do
  cache 'cache2', :expiry => 10, :compress => true do
    sleep(3)
    'Hello Cache2'
  end
end

# cache object
get '/obj' do
  hash = cache 'obj' do
    sleep(2)
    { :a => 'Hello Object' }
  end
  hash[:a]
end

# expire
get '/expire' do
  expire 'cache1'
  expire /^cache/
  expire //
  'Hello Expire'
end

# default options
set :cache_server, "localhost:11211"
set :cache_namespace, "sinatra-memcache"
set :cache_enable, true
set :cache_logging, true
set :cache_default_expiry, 3600
set :cache_default_compress, false

License

Copyright © 2009 Kazuki UCHIDA

Licensed under the MIT License:

- http://www.opensource.org/licenses/mit-license.php

sinatra-memcache's People

Contributors

gioext avatar rafaelss avatar

Stargazers

 avatar

Watchers

 avatar James Cloos 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.