define([ 'dojo/date/stamp', 'dojo/store/Cache', 'dojo/store/Memory', 'dojox/json/schema', './model/schema', './store/CouchStore' ],function(stamp,Cache,Memory,jsonSchema,schema,CouchStore){ var couchStore = new CouchStore({ target: 'data/couch/' /*, validate: function(object) { var result = jsonSchema.validate(object,schema); if ( result.valid ) { return true; } else { console.log("Found error ",result," for invalid object ",object); return false; } }*/ }); var memoryStore = new Memory({ idProperty: couchStore.idProperty }); var cacheStore = new Cache(couchStore,memoryStore,{ isLoaded: function(object) { // Unfortunately we cannot determine of the full documents were // loaded or not. Therefore never cache query results. return false; } }); var store = cacheStore; store.formatDate = function(date){ return stamp.toISOString(date,{zulu:true}); }; store.parseDate = function(dateString){ return stamp.fromISOString(dateString); }; store.timestamp = function() { return this.formatDate(new Date()); }; return store; });