Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby gem that allows people to memoize to memcache

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 config
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 patella.gemspec
README.md

Patella

Gem for the RailsConf 2012 talk Patella: It's Memoization into Memcached calculated in the background with Resque. www.slideshare.net/jdwyah/patella-railsconf-2012

Installation

Add this line to your application's Gemfile:

gem 'patella'

And then execute:

$ bundle

Or install it yourself as:

$ gem install patella

Usage

  def self.my_slow_method(user_id)
    all_notifications_for(User.find(user_id))
  end
  patella_reflex :my_slow_method, :expires_in => 3.minutes, :class_method => true

See the tests for more examples

Inlcude the partial:

  module ApplicationHelper
    include Patella::PatellaPartial
  end

Add a controller:

  class PatellaController < ApplicationController
    include Patella::Actions
    helper :some_app_helper_i_need
end

Then in your view:

= patella_partial @some_patella_obj, 'path/to/my/partial', :extra_things => :to_render_partial

And in the partial:

- your_patella_result = patella_obj
- lookup = User.find(extra_things)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Something went wrong with that request. Please try again.