
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@boardgame.io/storage-cache
Advanced tools
🔌 A caching layer for boardgame.io database connectors
This package provides a wrapper for boardgame.io storage implementations, adding an in-memory cache for the most recently used data.
The cache expects all interactions with the underlying database to pass through it, so it is not appropriate for situations where you may have multiple processes or server instances. There are also limitations to what can be reliably cached: listing all games will always require a call to your database.
npm install --save @boardgame.io/storage-cache
Instantiate your database class as usual and pass it to StorageCache
. This example uses the flat-file storage solution bundled with boardgame.io.
const { Server, FlatFile } = require('boardgame.io/server');
const { StorageCache } = require('@boardgame.io/storage-cache');
const { MyGame } = require('./game');
// instantiate the database class
const db = new FlatFile({ dir: '/storage/directory' });
// wrap the database with the caching layer
const dbWithCaching = new StorageCache(db, { cacheSize: 200 });
// pass the wrapped database to the boardgame.io server
const server = Server({
games: [MyGame],
db: dbWithCaching,
});
server.run(8000);
new StorageCache(database[, options])
database
StorageAPI.Async
instanceAn instance of a class implementing the boardgame.io storage API.
options
object
{}
An options object configuring the cache:
{
/**
* The number of games to cache in memory.
* @type {number}
* @default 1000
*/
cacheSize: 1000,
}
Bug reports, suggestions, and pull requests are very welcome! If you run into any problems or have questions, please open an issue.
Please also note the code of conduct and be kind to each other.
The code in this repository is provided under the MIT License.
FAQs
🔌 A caching layer for boardgame.io database connectors
The npm package @boardgame.io/storage-cache receives a total of 16 weekly downloads. As such, @boardgame.io/storage-cache popularity was classified as not popular.
We found that @boardgame.io/storage-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.