What is Nuts

NutsDB is a simple, fast, embeddable and persistent key/value store written in pure Go.

It supports fully serializable transactions and many data structures such as lis, set, sorted set. All operations happen inside a Tx. Tx represents a transaction, which can be read-only or read-write. Read-only transactions can read values for a given bucket and a given key or iterate over a set of key-value pairs. Read-write transactions can read, update and delete keys from the DB.

Github repository

https://github.com/nutsdb/nutsdb

Use Nuts

With Caddy

You have to build your caddy instance including Souin and Nuts using xcaddy (refer to the build caddy section).

  xcaddy build --with github.com/darkweak/souin/plugins/caddy --with github.com/darkweak/storages/nuts/caddy
  

You will be able to use nuts in your Caddyfile or JSON configuration file.

  {
    cache {
        ttl 1h
        nuts
    }
}

route {
    cache
    respond "Hello HTTP cache"
}
  

Configuration

You can find the configuration for Nuts here or check the values table below.

Values

Key nametyperequired
Dirstring
EntryIdxModeEntryIdxMode
RWModeRWMode
SegmentSizeint64
NodeNumint64
SyncEnablebool
MaxFdNumsInCacheint
CleanFdsCacheThresholdfloat64
BufferSizeOfRecoveryint
GCWhenClosebool
CommitBufferSizeint64
ErrorHandlerErrorHandler
LessFuncLessFunc
MergeIntervalDuration
MaxBatchCountint64
MaxBatchSizeint64
ExpiredDeleteTypeExpiredDeleteType
MaxWriteRecordCountint64