@exact-realty/memcached-encrypted-store
v1.0.1
Published
A secure and efficient encrypted store of keys and values for memcached
Downloads
6
Readme
memcached-encrypted-store 🗄️
A secure and efficient encrypted store of keys and values for memcached.
Welcome to memcached-encrypted-store
! This NPM package provides a convenient
solution for storing encrypted data in memcached, ensuring the confidentiality
and integrity of your cached information. With memcached-encrypted-store
, you
can protect your sensitive data while benefiting from the speed and scalability
of memcached.
✨ Features
- ✅ Securely store and retrieve keys and values in memcached
- ✅ Encryption of data with non-persistent symmetrical keys
- ✅ Data integrity verification to prevent tampering
- ✅ Configurable cache settings for optimal performance
- ✅ Simple and intuitive usage
🚀 Installation
To start using memcached-encrypted-store
in your project, simply install it
via npm:
npm install @exact-realty/memcached-encrypted-store
📝 Usage
To use memcached-encrypted-store
, follow these steps:
- Import the necessary modules:
import m from '@exact-realty/memcached-encrypted-store';
import Memcached from 'memcached';
- Initialize the encrypted memcached instance by providing the required configurations:
const encryptedMemcached = await m({
cacheMinAge: 1,
cacheMaxAge: 60,
cacheDefaultAge: 30,
cacheClockDriftAdjustment: 1,
memcached: new Memcached('memcached-server');
});
- Store a value in memcached:
const optionalTtl = 5;
await c('some-key', new Uint8Array([1,2,3]), optionalTtl);
// or altenatively (using the default TTL)
await c('some-key', new Uint8Array([1,2,3]));
// or (using object notation)
// note that fetching immediately after will likely fail, as this is
// an asynchronous operation
c['some-key'] = new Uint8Array([1,2,3]);
- Retrieve a value from memcached:
// Warning: may throw
console.log(await c['some-key']);
- Delete a value from memcached:
delete c['some-key'];
🤝 Contributing
🎉 We appreciate contributions from the community! If you have any ideas or suggestions, feel free to open an issue or submit a pull request.
📃 License
This project is licensed under the ISC License. See the LICENSE file for details.