nextjs-cache-handler-surrealdb
v1.1.3
Published
NextJS Cache handler using SurrealDB as the backing store.
Readme
nextjs-cache-handler-surrealdb
A NextJS compatible cache using SurrealDB as the backing database.
Sample usage:
// next.config.ts
module.exports = {
cacheHandler: require.resolve('nextjs-cache-handler-surrealdb'),
cacheMaxMemorySize: 0, // disable default in-memory caching
}
Control via environment variables:
SURREALDB_URL
URL to connect to the SurrealDB instance.
SURREALDB_USERNAME
Username used to connect to the SurrealDB instance.
SURREALDB_PASSWORD
Password used to connect to the SurrealDB instance.
SURREALDB_SCOPE
Scope used to connect to the SurrealDB instance.
SURREALDB_NAMESPACE
Namespace to store the db in
SURREALDB_DATABASE
Database to store the table in
NEXT_SURREALDB_CACHE_TABLE
Specify the table name
NEXT_SURREALDB_CACHE_AUTO_SWEEP
Enable automatically clearing out expired entries. Defaults to true.
NEXT_SURREALDB_CACHE_AUTO_SWEEP_INTERVAL_MS
How much time to wait before clearing out expired entries in milliseconds. Defaults to 5 minutes.
NEXT_SURREALDB_CACHE_MAX_AGE_MS
Define a max time limit for entries in milliseconds. Defaults to 5 minutes. Set to -1 to disable.
Notes
It may be necessary to increase the following environment variables for SurrealDB e.g. to 10mib
SURREAL_HTTP_MAX_RPC_BODY_SIZE='10 MiB'
SURREAL_HTTP_MAX_SQL_BODY_SIZE='10 MiB'License
This project is licensed under the standard MIT license. Use at your own risk.
