Skip to content

v0.5.0

Choose a tag to compare

@pilcrowonpaper pilcrowonpaper released this 09 Sep 23:37
· 1 commit to main since this release

Overview

  • Simplified storage.

New storage interface

Main storage, rate limit storage, and cache has been unified into a single storage. The mainStorage, rateLimitStorage, and cache parameters of NewSever() has been replaced by a single storage parameter. The MainStorageInterface, RateLimitStorage, and CacheInterface has been replaced by StorageInterface.

The new StorageInterface has a similar API to the previous MainStorageInterface, but with the errors replaced and the Set() method replaced by an Add() method.

type StorageInterface interface {
	Get(key string) ([]byte, int32, error)
	Add(key string, value []byte, expiresAt time.Time) error
	Update(key string, value []byte, expiresAt time.Time, counter int32) error
	Delete(key string) error
}

Note all existing data will be invalid.

Pull requests