5 notes &
More Manos Manuals: Timeouts and Object Caching and a release coming soon
Just added some more docs on Manos.
Timeouts
The first doc I added is on the timeout system for scheduling periodic tasks to be performed in the Manos pipeline. Here’s a quick example:
MyManosApp ()
{
AddTimeout (TimeSpan.FromMinutes (5),
RepeatBehavior.Forever,
(app, data) => app.Cache.Clear ());
}
That will clear the application’s object cache every five minutes. You can also specifiy a number of iterations using RepeatBehavior.Iterations (count) or create a custom repeat behavior using the IRepeatBehavior interface.
Timeouts are just for simple tasks, they run in the main message loop, so there aren’t guarantees on when they will fire, and they will not fire if the application is stopped. So timeouts should not be treated as a task scheduler system like django’s Celery project. In the future I will be adding a robust task scheduling system to Manos though.
More info can be found here:
http://github.com/jacksonh/manos/blob/master/docs/timeouts.md
Object Caching
The object cache is simply a server side cache for storing objects by key. This isn’t for view/page caching, this is just for sticking objects in a temporary storage area while the app is running. Right now there is only an in-process cache, but I’m planning on adding a memcached backend this week.
Here’s a quick example:
MyManosApp ()
{
Cache ["foobar"] = "I am the foobar string";
}
The one feature that the cache offers that’s beyond a simple dictionary interface is time based expiration. So if you want your object to go away in 15 minutes, you can just do this:
MyManosApp ()
{
Cache.Set ("foobar",
"I am the foobar string",
TimeSpan.FromMinutes (15));
}
The rest of the doc can be found here:
http://github.com/jacksonh/manos/blob/master/docs/object-cache.md
Coming Soon
Manos is starting to gain some interest and I’m hoping to do a stripped down release in the next couple of weeks. I’m still not happy with the templating system, so that will probably be disabled, but building things like web services should be pretty easy. And you can always build websites using a different templating system like StringTemplate.
I still haven’t done a comprehensive what/why/how document for Manos that will explain what it does, why i think its useful and how it works. I’ve been intentionally avoiding this because I don’t like announcing things that aren’t usable, but unfortunately all my ‘feedback requested’ blog entries lately have done that for me. This document should be out around the same time as the release.