cago

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2024 License: BSD-3-Clause Imports: 9 Imported by: 0

README

Cago

Go Reference CI Coverage Go Report Card Mentioned in Awesome Go

Thread safe GoLang Cago cache.

Cache Go, key value store in memory

Features

go get github.com/jasakode/cago
package main

import "github.com/jasakode/cago"

func main() {
    err := cago.New()
    if err != nil {
        panic(err.Error())
    }
}

Execut set in another file in project

package other

import "github.com/jasakode/cago"

func main() {
    store := cago.Get("test")
    fmt.Println(store.Text())
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear() error

func Exist

func Exist(key string) bool

Exist checks if a given key exists in the app's data map and returns true if it exists.

func Get

func Get[K store.Compare](key string) *K

Get retrieves a value from the application data.

func New

func New(config ...Config) error

func Put

func Put(key string, value store.Compare, maxAge ...uint64) bool

func Remove

func Remove(key string) bool

func Set

func Set(key string, value store.Compare, maxAge ...uint64) error

set store

Types

type App

type App struct {
	// contains filtered or unexported fields
}

func (*App) InitializeDB

func (app *App) InitializeDB() error

type Config

type Config struct {
	// Path ke file database.
	// Ini adalah lokasi spesifik file.
	// Jika path tidak ditentukan, data akan hilang ketika proses dihentikan.
	Path string
	// Memori maksimal yang akan digunakan,
	// ditentukan dalam bit.
	// 8.388.608 bit = 1 MB
	// default : 8589934592 bit / 1 GB
	MAX_MEM uint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL