loopback-connector-memcached
Memcached loopback.io connector. Please fork and enhance or file a bug ticket if you discover any issues.
Why?
Why not? This is was more of a learning exercise to get acclimated to Loopback.io, however, someone may find it useful.
Use cases
- Query Memcached nodes via HTTP
- Common interface (Client.find(), Client.findOne(), etc)
Usage
To effectively use this connector, you need to create a model with the following properties:
- /common/models/memcached.json
yo loopback:model>> enter model name
- id - Key to use for caching item
- data - Data to cache
- ttl - The time to live for the cached item
Sample Model JS (ie: memcached.js)
- /common/models/memcached.js
module { // Add additional remote methods Cache};
Sample datasources.json
Sample boot script (accounts.js)
- /server/boot/accounts.js
module { var Cache = appmodelsCache; var Model = appmodelsMemcached; var model = id: <id> data: <data> ttl: <ttl> ; if model;};