think-cache
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -16,6 +16,6 @@ const assert = require('assert'); | ||
assert(name && helper.isString(name), 'cache.name must be a string'); | ||
if (this.config) { | ||
if (config) { | ||
config = helper.parseAdapterConfig(this.config('cache'), config); | ||
} else { | ||
config = helper.parseAdapterConfig(config); | ||
config = helper.parseAdapterConfig(this.config('cache')); | ||
} | ||
@@ -36,2 +36,3 @@ const Handle = config.handle; | ||
} | ||
// get cache when value is function | ||
@@ -38,0 +39,0 @@ if (helper.isFunction(value)) { |
{ | ||
"name": "think-cache", | ||
"description": "Cache for ThinkJS", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "welefen", |
@@ -5,3 +5,3 @@ /* | ||
* @Last Modified by: lushijie | ||
* @Last Modified time: 2017-03-15 10:28:20 | ||
* @Last Modified time: 2017-09-13 11:49:47 | ||
*/ | ||
@@ -19,3 +19,3 @@ import test from 'ava'; | ||
return { | ||
type: 'cache' | ||
type: 'file' | ||
} | ||
@@ -55,2 +55,3 @@ } | ||
test('get by cache name', async t => { | ||
@@ -66,3 +67,16 @@ let ret = await cacheDB.apply(thisConfig, ['name', undefined, getConfig()]); | ||
test('set cache 2', async t => { | ||
const this_Config = { | ||
config(name) { | ||
return { | ||
type: 'file', | ||
handle: Redis | ||
} | ||
} | ||
} | ||
let ret = await cacheDB.apply(this_Config, ['name', 'thinkjs']); | ||
t.true(ret); | ||
}); | ||
test('get cache when value is function and function return undefined', async t => { | ||
@@ -69,0 +83,0 @@ let argName = 'nothave'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7207
158