Permalink
Browse files

support for Pantry > v0.3.0

  • Loading branch information...
Edward de Groot
Edward de Groot committed Mar 21, 2012
1 parent c9e4b1d commit 12575a331e6e621f552fd671a020b91e39e99683
Showing with 37 additions and 5 deletions.
  1. +21 −0 README.md
  2. +10 −0 examples/server-redis.coffee
  3. +1 −1 examples/server.coffee
  4. +1 −1 package.json
  5. +4 −3 src/timbits.coffee
View
@@ -143,6 +143,27 @@ New in v0.3.0, view helpers are now loaded automagically from the ./helpers fold
For example, if you create a file called ./helpers/handy.coffee (like we did in examples), timbits will automatically include all the exported functions from handy.coffee under the helper 'handy'. See the 'with-help' view for the plain timbit as an example.
+### Advanced caching via pantry
+
+As of [Pantry](https://github.com/Postmedia/pantry) v0.3.0, you are now able to configure alternate storage caches. As of Timbits v0.5.0 one can now control the pantry configuration properties as well as substitute the default MemoryStorage caching via the exported timbits.pantry property.
+
+ var RedisStorage, server, timbits;
+
+ timbits = require('../src/timbits');
+
+ RedisStorage = require('pantry/lib/pantry-redis');
+
+ timbits.pantry.storage = new RedisStorage(null, null, null, 'DEBUG');
+
+ timbits.pantry.configure({
+ verbosity: 'DEBUG'
+ });
+
+ server = timbits.serve({
+ home: __dirname
+ });
+
+
## Road Map
We have a number of items in the pipeline which we believe will provide a lot of power to this platform, such as:
@@ -0,0 +1,10 @@
+# Module dependencies.
+timbits = require '../src/timbits'
+
+# use redis for caching
+RedisStorage = require 'pantry/lib/pantry-redis'
+timbits.pantry.storage = new RedisStorage(null, null, null, 'DEBUG')
+timbits.pantry.configure {verbosity: 'DEBUG'}
+
+# start serving timbits
+server = timbits.serve {home: __dirname}
View
@@ -2,4 +2,4 @@
timbits = require '../src/timbits'
# start serving timbits
-server = timbits.serve {home: __dirname}
+server = timbits.serve {home: __dirname}
View
@@ -18,7 +18,7 @@
"connect-less": ">= 0.2.3",
"express": ">= 2.5.6",
"jsonp-filter": ">= 0.0.2",
- "pantry": ">= 0.2.0 < 0.3.0",
+ "pantry": ">= 0.3.0",
"request": ">= 2.9.1",
"optimist": ">= 0.2.6",
"run": ">= 0.2.3"
View
@@ -8,7 +8,7 @@ Log = require 'coloured-log'
assets = require 'connect-assets'
connectESI = require 'connect-esi'
express = require 'express'
-pantry = require 'pantry'
+@pantry = pantry = require 'pantry'
request = require 'request'
jsonp = require 'jsonp-filter'
less = require 'connect-less'
@@ -31,10 +31,11 @@ log = new Log()
@serve = (options) ->
config[key] = value for key, value of options
@server = express.createServer()
-
+
+ # init log
log = new Log(if @server.settings.env is 'development' then Log.DEBUG else Log.INFO)
- # support coffekup
+ # support coffeekup
@server.register '.coffee', ck
# configure server (still needs some thought)

0 comments on commit 12575a3

Please sign in to comment.