Files
storage/memory
Fenny 9dd375b336 🧪 add test
2020-11-04 02:13:36 +01:00
..
2020-11-03 08:26:25 +08:00
🧪 add test
2020-11-04 02:13:36 +01:00
2020-11-03 08:26:25 +08:00
2020-11-02 15:01:57 +01:00

Memory

An in-memory storage driver.

Table of Contents

Signatures

func New(config ...Config) Storage

Examples

Import the storage package.

import "github.com/gofiber/storage/memory"

You can use the following possibilities to create a storage:

// Initialize default config
store := memory.New()

// Initialize custom config
store := memory.New(memory.Config{
	GCInterval: 10 * time.Second,
})

Config

type Config struct {
	// Time before deleting expired keys
	//
	// Default is 10 * time.Second
	GCInterval time.Duration
}

Default Config

var ConfigDefault = Config{
	GCInterval: 10 * time.Second,
}