func New(config ...Config) Storage
func (s *Storage) Get(key string) ([]byte, error)
func (s *Storage) Set(key string, val []byte, exp time.Duration) error
func (s *Storage) Delete(key string) error
func (s *Storage) Reset() error
func (s *Storage) Close() error
func (s *Storage) Conn() driver.Client
Installation
ArangoDB는 module 지원으로 최근 2개 (1.14/1.15) Go 버전에서 테스트됩니다. 아직 초기화하지 않았다면 먼저 초기화해야 합니다:
go mod init github.com/<user>/<repo>
그런 다음 mysql 구현을 설치합니다:
go get github.com/gofiber/storage/arangodb/v2
Examples
storage 패키지를 import 합니다.
import "github.com/gofiber/storage/arangodb/v2"
다음과 같은 방법으로 storage를 생성할 수 있습니다:
// 기본 config 초기화
store := arangodb.New()
// 커스텀 config 초기화
store := arangodb.New(arangodb.Config{
Host: "http://127.0.0.1",
Port: 8529,
Database: "fiber",
Collection: "fiber_storage",
Reset: false,
GCInterval: 10 * time.Second,
})
Config
type Config struct {
// DB가 호스팅되는 Host name
//
// Optional. Default is "http://127.0.0.1"
Host string
// DB가 수신하는 Port
//
// Optional. Default is 8529
Port int
// Server username
//
// Optional. Default is ""
Username string
// Server password
//
// Optional. Default is ""
Password string
// Database 이름
//
// Optional. Default is "fiber"
Database string
// Collection 이름
//
// Optional. Default is "fiber_storage"
Collection string
// Reset은 기존 collection의 기존 key를 모두 지웁니다
//
// Optional. Default is false
Reset bool
// 만료된 key를 삭제하기 전 시간
//
// Optional. Default is 10 * time.Second
GCInterval time.Duration
}