CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Thu, 07 Aug 2025 23:08:39 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20081211172718
location: https://web.archive.org/web/20081211172718/https://github.com/webs/interlock/tree
server-timing: captures_list;dur=0.724884, exclusion.robots;dur=0.020237, exclusion.robots.policy;dur=0.007843, esindex;dur=0.009786, cdx.remote;dur=15.145926, LoadShardBlock;dur=157.519402, PetaboxLoader3.resolve;dur=80.216199, PetaboxLoader3.datanode;dur=41.747024
x-app-server: wwwb-app239
x-ts: 302
x-tr: 1241
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
set-cookie: wb-p-SERVER=wwwb-app239; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 301
server: nginx
date: Thu, 07 Aug 2025 23:08:40 GMT
content-type: text/html; charset=utf-8
content-length: 110
x-archive-orig-server: nginx/0.6.31
x-archive-orig-date: Thu, 11 Dec 2008 17:27:15 GMT
x-archive-orig-connection: close
x-archive-orig-status: 301 Moved Permanently
location: https://web.archive.org/web/20081211172718/https://github.com/webs/interlock/tree/master
x-archive-orig-x-runtime: 841ms
x-archive-orig-cache-control: no-cache
x-archive-orig-content-length: 110
cache-control: max-age=1800
memento-datetime: Thu, 11 Dec 2008 17:27:18 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Thu, 11 Dec 2008 17:27:18 GMT", ; rel="memento"; datetime="Thu, 11 Dec 2008 17:27:18 GMT", ; rel="last memento"; datetime="Thu, 11 Dec 2008 17:27:18 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_7_20081211151037_crawl106-c/52_7_20081211172514_crawl103.arc.gz
server-timing: captures_list;dur=0.535239, exclusion.robots;dur=0.018058, exclusion.robots.policy;dur=0.007234, esindex;dur=0.010062, cdx.remote;dur=5.887287, LoadShardBlock;dur=256.100793, PetaboxLoader3.resolve;dur=288.113425, PetaboxLoader3.datanode;dur=113.238773, load_resource;dur=207.203050
x-app-server: wwwb-app239
x-ts: 301
x-tr: 494
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Thu, 07 Aug 2025 23:08:42 GMT
content-type: text/html; charset=utf-8
x-archive-orig-server: nginx/0.6.26
x-archive-orig-date: Thu, 11 Dec 2008 17:27:18 GMT
x-archive-orig-connection: close
x-archive-orig-status: 200 OK
x-archive-orig-x-runtime: 2979ms
x-archive-orig-etag: "ba1c045c6bcd8fcb4e583537d689ffd1"
x-archive-orig-cache-control: private, max-age=0, must-revalidate
x-archive-orig-content-length: 23416
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Thu, 11 Dec 2008 17:27:18 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Thu, 11 Dec 2008 17:27:18 GMT", ; rel="memento"; datetime="Thu, 11 Dec 2008 17:27:18 GMT", ; rel="last memento"; datetime="Thu, 11 Dec 2008 17:27:18 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_7_20081211151037_crawl106-c/52_7_20081211172514_crawl103.arc.gz
server-timing: captures_list;dur=0.369853, exclusion.robots;dur=0.010925, exclusion.robots.policy;dur=0.004543, esindex;dur=0.006342, cdx.remote;dur=4.533081, LoadShardBlock;dur=516.062525, PetaboxLoader3.datanode;dur=379.889953, PetaboxLoader3.resolve;dur=1718.365834, load_resource;dur=1861.216329
x-app-server: wwwb-app239
x-ts: 200
x-tr: 2446
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=1
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
webs's interlock at master — GitHub
This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (

This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (

Fork of fauna/interlock | |
Description: | A Rails plugin for maintainable and high-efficiency caching |
Homepage: | https://blog.evanweaver.com/files/doc/fauna/interlock/ |
Clone URL: |
git://github.com/webs/interlock.git
Give this clone URL to anyone.
git clone git://github.com/webs/interlock.git
|
name | age | message | |
---|---|---|---|
![]() |
.gitignore | Thu Jul 03 08:09:03 -0700 2008 | custom .gitignore [Mauro Pompilio] |
![]() |
CHANGELOG | Wed Aug 20 20:51:25 -0700 2008 | Changelog. [Evan Weaver] |
![]() |
LICENSE | Tue Dec 11 12:36:51 -0800 2007 | interlock gets licensed [evan] |
![]() |
Manifest | Thu Feb 14 15:17:42 -0800 2008 | Backport tests and fixes for finder caching. [evan] |
![]() |
README | Wed Aug 20 20:51:25 -0700 2008 | Changelog. [Evan Weaver] |
![]() |
Rakefile | Thu Feb 14 15:17:42 -0800 2008 | Backport tests and fixes for finder caching. [evan] |
![]() |
TODO | Thu Feb 21 11:36:43 -0800 2008 | Add a TODO item. [evan] |
![]() |
examples/ | Fri Feb 01 19:31:11 -0800 2008 | Support new legacy Rails wrapper for C memcache... [evan] |
![]() |
init.rb | Sun Nov 11 19:45:56 -0800 2007 | interlock sneaks into fauna [evan] |
![]() |
lib/ | Sat Nov 01 07:52:38 -0700 2008 | Fixed cache(), now working on Rails Edge [webs] |
![]() |
tasks/ | Tue Jan 15 11:25:42 -0800 2008 | add rake task [evan] |
![]() |
test/ | Wed Aug 20 21:02:19 -0700 2008 | Merge branch 'master' of git://github.com/sujal... [Evan Weaver] |
README
Interlock A Rails plugin for maintainable and high-efficiency caching. == License Copyright 2007, 2008 Cloudburst, LLC. Licensed under the AFL 3. See the included LICENSE file. Portions copyright 2006 Chris Wanstrath and used with permission. The public certificate for the gem is here[https://rubyforge.org/frs/download.php/25331/evan_weaver-original-public_cert.pem]. If you use this software, please {make a donation}[https://blog.evanweaver.com/donate/], or {recommend Evan}[https://www.workingwithrails.com/person/7739-evan-weaver] at Working with Rails. == Requirements * memcached (https://www.danga.com/memcached) * memcache-client gem * Rails 2.1 == Features Interlock is an intelligent fragment cache for Rails. It works by making your view fragments and associated controller blocks march along together. If a fragment is fresh, the controller behavior won't run. This eliminates duplicate effort from your request cycle. Your controller blocks run so infrequently that you can use regular ActiveRecord finders and not worry about object caching at all. Invalidations are automatically tracked based on the model lifecyle, and you can scope any block to an arbitrary level. Interlock also caches <tt>content_for</tt> calls, unlike regular Rails, and can optionally cache simple finders. Interlock uses a tiered caching layer so that multiple lookups of a key only hit memcached once per request. == Installation First, compile and install memcached itself. Get a memcached server running. You also need either <tt>memcache-client</tt> or {memcached}[https://blog.evanweaver.com/files/doc/fauna/memcached]: sudo gem install memcache-client Then, install the plugin: script/plugin install git://github.com/fauna/interlock.git Lastly, configure your Rails app for memcached by creating a <tt>config/memcached.yml</tt> file. The format is compatible with Cache_fu: defaults: namespace: myapp sessions: false client: memcache-client development: servers: - 127.0.0.1:11211 # Default host and port production: servers: - 10.12.128.1:11211 - 10.12.128.2:11211 Now you're ready to go. Note that if you have the {memcached}[https://blog.evanweaver.com/files/doc/fauna/memcached] client, you can use <tt>client: memcached</tt> for better performance. == Usage Interlock provides two similar caching methods: <tt>behavior_cache</tt> for controllers and <tt>view_cache</tt> for views. They both accept an optional list or hash of model dependencies, and an optional <tt>:tag</tt> keypair. <tt>view_cache</tt> also accepts a <tt>:ttl</tt> keypair. The simplest usage doesn't require any parameters. In the controller: class ItemsController < ActionController::Base def slow_action behavior_cache do @items = Item.find(:all, :conditions => "be slow") end end end Now, in the view, wrap the largest section of ERB you can find that uses data from <tt>@items</tt> in a <tt>view_cache</tt> block. No other part of the view can refer to <tt>@items</tt>, because <tt>@items</tt> won't get set unless the cache is stale. <% @title = "My Sweet Items" %> <% view_cache do %> <% @items.each do |item| %> <h1><%= item.name %></h1> <% end %> <% end %> You have to do them both. This automatically registers a caching dependency on Item for <tt>slow_action</tt>. The controller block won't run if the <tt>slow_action</tt> view fragment is fresh, and the view fragment will only get invalidated when an Item is changed. You can use multiple instance variables in one block, of course. Just make sure the <tt>behavior_cache</tt> provides whatever the <tt>view_cache</tt> uses. See ActionController::Base and ActionView::Helpers::CacheHelper for more details. == Caching finders Interlock 1.3 adds the ability to cache simple finder lookups. Add this line in <tt>config/memcached.yml</tt>: with_finders: true Now, whenever you call <b>find</b>, <b>find_by_id</b>, or <b>find_all_by_id</b> with a single id or an array of ids, the cache will be used. The cache key for each record invalidates when the record is saved or destroyed. Memcached's multiget mode is used for maximum performance. If you pass any parameters other than ids, or use dynamic finders, the cache will not be used. This means that <tt>:include</tt> works as expected and does not require complicated invalidation. See Interlock::Finders for more. == Notes You will not see any actual cache reuse in development mode unless you set <tt>config.action_controller.perform_caching = true</tt> in <tt>config/environments/development.rb</tt>. <b>If you have custom <tt>render</tt> calls in the controller, they must be outside the <tt>behavior_cache</tt> blocks.</b> No exceptions. For example: def profile behavior_cache do @items = Item.find(:all, :conditions => "be slow") end render :action => 'home' end You can write custom invalidation rules if you really want to, but try hard to avoid it; it has a significant cost in long-term maintainability. Also, Interlock obeys the <tt>ENV['RAILS_ASSET_ID']</tt> setting, so if you need to blanket-invalidate all your caches, just change <tt>RAILS_ASSET_ID</tt> (for example, you could have it increment on every deploy). == Further resources * https://blog.evanweaver.com/articles/2007/12/13/better-rails-caching/ * https://www.socialtext.net/memcached/index.cgi?faq == Reporting problems The support forum is here[https://rubyforge.org/forum/forum.php?forum_id=19835]. Patches and contributions are very welcome. Please note that contributors are required to assign copyright for their additions to Cloudburst, LLC.
This feature is coming soon. Sit tight!