Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kbarbounakis/most-data-memcached
Most Web Framework Memcached Caching Adapter
https://github.com/kbarbounakis/most-data-memcached
Last synced: 1 day ago
JSON representation
Most Web Framework Memcached Caching Adapter
- Host: GitHub
- URL: https://github.com/kbarbounakis/most-data-memcached
- Owner: kbarbounakis
- License: bsd-3-clause
- Created: 2015-07-21T03:58:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-08-23T09:04:59.000Z (about 6 years ago)
- Last Synced: 2024-11-09T05:42:54.269Z (8 days ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## Most Web Framework Data Caching Service with Memcached
@themost/memcached implements the usage of [Memcached](https://memcached.org/)
as backend for caching data inside [Most Web Framework](https://github.com/themost-framework/themost) applications.### Installation
npm install @themost/memcached
### Configuration
Add settings/memcached section in your application configuration file (config/app.json)
...
"settings": {
"memcached": {
"host": "127.0.0.1",
"port": 11211,
"maxExpiration": 1200
},
...
"auth": {
"name": ".MAUTH",
"timeout": 480,
"slidingExpiration": false
},
...
}
...* `host`: the memcached server host address (the default value is 127.0.0.1)
* `port`: the memcached server port (the default value is 11211)
* `maxExpiration`: the maximum expiration time of keys (in seconds).For a complete documentation about memcached extra options read
[memcached module docs](https://github.com/3rd-Eden/memcached#options)### Usage
In your application startup script register MemcachedCacheStrategy as DataCacheStrategy:
import {HttpApplication} from '@themost/web/app';
import path from 'path';
import {LocalizationStrategy, I18nLocalizationStrategy} from "@themost/web/localization";
import {DataCacheStrategy} from "@themost/data";
import {MemcachedCacheStrategy} from "@themost/memcached";
//initialize app
let app = new HttpApplication(path.resolve(__dirname));
//set static content
app.useStaticContent(path.resolve('./app'));
//use i18n localization strategy
app.useStrategy(LocalizationStrategy, I18nLocalizationStrategy);
//use memcached as caching strategy
app.getConfiguration().useStrategy(DataCacheStrategy, MemcachedCacheStrategy);
//start http application
app.start({
port:process.env.PORT ? process.env.PORT: 3000,
bind:process.env.IP || '0.0.0.0'
});