Skip to content

Commit

Permalink
feat(store): default to memory store
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanebachelier committed Feb 22, 2016
1 parent b8b5faf commit f7f4d58
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

import readCache from './read-cache'
import serialize from './serialize'
import memoryStore from './memory'

function cache (config = {}) {
if (!config.store) {
const store = config.store || memoryStore
const key = config.key || cache.key

if (!store) {
throw new Error('Cache middleware need to be provided a store.')
}

const store = config.store
const key = config.key || cache.key

config.maxAge = config.maxAge || 0
config.readCache = config.readCache || readCache
config.serialize = config.serialize || serialize
Expand Down

0 comments on commit f7f4d58

Please sign in to comment.