1.0.1 ā€¢ Published 7 months ago

@exact-realty/memcached-encrypted-store v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

memcached-encrypted-store šŸ—„ļø

License

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:

  1. Import the necessary modules:
import m from '@exact-realty/memcached-encrypted-store';
import Memcached from 'memcached';
  1. 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');
});
  1. 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]);
  1. Retrieve a value from memcached:
// Warning: may throw
console.log(await c['some-key']);
  1. 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.