What is @graphql-mesh/store?
@graphql-mesh/store is a package that provides a storage solution for GraphQL Mesh, allowing you to store and retrieve data in a consistent manner across different environments.
What are @graphql-mesh/store's main functionalities?
File Store
The File Store feature allows you to store data in the file system. This is useful for local development and testing where you want to persist data between runs.
const { FsStoreStorageAdapter } = require('@graphql-mesh/store');
const store = new FsStoreStorageAdapter({ cwd: process.cwd() });
store.set('key', 'value');
const value = store.get('key');
In-Memory Store
The In-Memory Store feature provides a volatile storage solution that keeps data in memory. This is ideal for scenarios where persistence is not required, such as in-memory caching.
const { InMemoryStoreStorageAdapter } = require('@graphql-mesh/store');
const store = new InMemoryStoreStorageAdapter();
store.set('key', 'value');
const value = store.get('key');
Other packages similar to @graphql-mesh/store
node-persist
node-persist is a simple, zero-dependency, key-value storage library for Node.js that supports both in-memory and file-based storage. It is similar to @graphql-mesh/store in providing a way to persist data, but it is more general-purpose and not specifically designed for GraphQL Mesh.
lowdb
lowdb is a small local JSON database powered by Lodash. It is similar to @graphql-mesh/store in that it provides a simple way to store and retrieve data, but it is more focused on being a lightweight database solution rather than a storage adapter for GraphQL Mesh.