open-index/open-npm huggingface dataset:
npm package: @memzy/node-sdk
Description: Memzy is a sleek, ready-to-use remote memory caching solution crafted for Node.js developers.
Author: madebywelch
Latest version: 1.2.6

## Memzy: Seamless Remote Memory Caching for Node.js

Memzy is a sleek, ready-to-use remote memory caching solution crafted for Node.js developers.

## Why Use Memzy?

- Simplicity: Memzy is designed for developers who want a caching solution that is straightforward to integrate. No extensive setup procedures or hefty configurations required. Plug in your API key, specify a region, and you're good to go.

- Remote Memory Management: Memzy allows you to offload your caching needs to our dedicated remote regions, meaning you don't use up your local resources. This also allows for high availability and centralized caching for distributed systems.

- Quick Prototyping: With Memzy, there's no need for accounts, or credit cards. Use Memzy for quick prototyping and testing without any commitments.

- Integrated Encryption: Memzy offers built-in encryption capabilities, allowing you to ensure your cached data remains confidential, even in transit and at rest.

## Installation

```bash
npm install @memzy/node-sdk
```

## Usage

### Basic Usage

```javascript
import { Memzy } from "@memzy/node-sdk";

// You should bring your own "api key." It should be a > 15 < 100 char string.
// Think of API keys as partitions, or namespaces for your data.
const memzy = new Memzy({
  apiKey: "your-api-key",
  region: "atlanta",
});

console.log('Setting key "testKey" to "Hello, Memzy!"');
await memzy.Set("testKey", "Hello, Memzy!");

console.log('Getting value for key "testKey"');
const value = await memzy.Get("testKey");
console.log("Value:", value);

console.log('Deleting key "testKey"');
await memzy.Del("testKey");

console.log('Attempting to get deleted key "testKey"');
try {
  const deletedValue = await memzy.Get("testKey");
  console.log("Value:", deletedValue);
} catch (error) {
  console.log("Expected error:", error.message);
}

console.log('Subscribing to "testEvent"');
memzy.Subscribe("testEvent", (data) => {
  console.log('Received data from "testEvent":', data);
});

console.log('Publishing event "testEvent" with data "This is a test event"');
await memzy.Publish("testEvent", "This is a test event");
```

### Using Encryption

```javascript
import { Memzy } from "@memzy/node-sdk";

// Generate a 256-bit encryption key using a trusted method and store it securely.
const encryptionKey =
  "78d8339ea613d4cf1012075bd20c289e01565cee906039e03dbc8b2ec4a63df1"; // Example key

const memzy = new Memzy({
  apiKey: "your-api-key",
  region: "atlanta",
  encryptionKey: encryptionKey, // Pass the encryption key here
});

console.log('Setting encrypted key "secureKey" to "This is confidential"');
await memzy.Set("secureKey", "This is confidential");

console.log('Getting decrypted value for key "secureKey"');
const decryptedValue = await memzy.Get("secureKey");
console.log("Decrypted Value:", decryptedValue);
```