thinkjs / think-html-cache Goto Github PK
View Code? Open in Web Editor NEWhtml-cache middleware for ThinkJS 2.0
License: MIT License
html-cache middleware for ThinkJS 2.0
License: MIT License
Error: adapter
adapter_store_basenot found at Function.Adapter.get (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_adapter.js:67:9) at Object.Adapter (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_adapter.js:37:22) at _default.run$ (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\lib\index.js:69:25) at tryCatch (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:67:40) at GeneratorFunctionPrototype.invoke [as _invoke] (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:315:22) at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:100:21) at invoke (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:136:37) at enqueueResult (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:185:17) at new Promise (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\core-js\library\modules\es6.promise.js:201:7) at AsyncIterator.enqueue (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:184:12) at AsyncIterator.prototype.(anonymous function) [as next] (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:100:21) at Object.runtime.async (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\node_modules\babel-runtime\regenerator\runtime.js:209:12) at _default.run (F:\workspace\web\trunk\market_v2\node_modules\think-html-cache\lib\index.js:37:32) at Function.Middleware.exec (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_middleware.js:80:34) at _execItemMiddleware (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_hook.js:92:27) at Function.Hook.exec (F:\workspace\web\trunk\market_v2\node_modules\thinkjs\src\core\think_hook.js:108:10)
配置:
export default {
on: true, //use html_cache
type: 'base', //cache content store type
timeout: 0,
callback: function(key) {
return think.md5(key);
},
rules: {
'sites/index/index': ['index/{page}']
},
//adapter config
adapter: {
file: {
path: think.RUNTIME_PATH + '/html_cache' //when type is file, set cache path
}
}
};
其他的都一致, 视图使用的是"/"而不是"_"
如题。。
rules
cache rules, key is [module]/[controller]/[action].
can get paramters in rule:
'index_{page}' // get page paramter from GET 'index_{:module}' // get module value 'index_{:controller}' //get controller value 'index_{:action}' //get action value 'index_{cookie.xxx}' //get value from cookie
我只想缓存一个页面的话。需要怎么配置?
这些配置都有啥作用呢?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.