var Prana = require('prana');
var MongoDBStorage = require('prana-mongodb');
var MongoClient = require('mongodb').MongoClient;
var application = new Prana();
MongoClient.connect('mongodb://localhost/database', function(error, database) {
application.storage('mongodb', {
controller: MongoDBStorage,
database: database
});
var Cache = application.type('cache', {
title: 'Cache',
description: 'A very simple key/value cache storage mechanism.',
path: 'cache',
storage: 'mongodb'
});
var cache = new Cache({
name: 'some-cache',
value: 'some-cache-value'
});
cache.save(function(error, item) {
console.log('Added item');
console.log(item);
database.close();
});
});