cache

package
v1.0.4 Latest Latest
Warning

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

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

README

Creates lua user data cache_ud.

Golang

	state := lua.NewState()
	cache.Preload(state)
	// register user data "cache"
	cache.NewSqlite(state, "cache", "/tmp/db.sqlite")

Lua

cache:set(string, number)

Set number to cache by key string, raise error.

cache:get(string)

Get number (value) and number (time updated_at) from cache by key string. Return two number or two nil, raise error.

cache:diff_and_set(string, value)

Get number, diff from previous value. Return number or nil, raise error.

cache:speed_and_set(string, value)

Get number, speed based on previous value. Return number or nil, raise error.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSqlite

func NewSqlite(L *lua.LState, userDataName, fileName, prefix string) error

NewSqlite open new sqlite cache

func Preload

func Preload(L *lua.LState) int

Preload is the preloader of user data cache_ud.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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