Documentation
¶
Overview ¶
Package acdb manages objects between memory and file system.
Index ¶
- type Client
- func (e *Client) Del(k string) error
- func (e *Client) Get(k string) ([]byte, error)
- func (e *Client) GetDecode(k string, v any) error
- func (e *Client) GetFloat32(k string) (float32, error)
- func (e *Client) GetFloat64(k string) (float64, error)
- func (e *Client) GetInt(k string) (int, error)
- func (e *Client) GetInt32(k string) (int32, error)
- func (e *Client) GetInt64(k string) (int64, error)
- func (e *Client) GetString(k string) (string, error)
- func (e *Client) GetUint(k string) (uint, error)
- func (e *Client) GetUint32(k string) (uint32, error)
- func (e *Client) GetUint64(k string) (uint64, error)
- func (e *Client) Has(k string) bool
- func (e *Client) Log(l int)
- func (e *Client) Nil(k string) bool
- func (e *Client) Set(k string, v []byte) error
- func (e *Client) SetEncode(k string, v any) error
- type DocDriver
- type Driver
- type LruDriver
- type MapDriver
- type MemDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a actuator of the given drive. Do not worry, Is's concurrency-safety.
func (*Client) GetFloat32 ¶
GetFloat32 get the float32 value of a key.
func (*Client) GetFloat64 ¶
GetFloat64 get the float64 value of a key.
type DocDriver ¶
type DocDriver struct {
// contains filtered or unexported fields
}
DocDriver use the OS's file system to manage data. In general, any high frequency operation is not recommended unless you have an enough reason.
type Driver ¶
type Driver interface {
Get(k string) ([]byte, error)
Set(k string, v []byte) error
Del(k string) error
}
Driver is the interface that wraps the Set/Get and Del method.
Get gets and returns the bytes or any error encountered. If the key does not exist, ErrNotExist will be returned. Set sets bytes with given k. Del dels bytes with given k. If the key does not exist, ErrNotExist will be returned.
type LruDriver ¶
type LruDriver struct {
// contains filtered or unexported fields
}
LruDriver implemention. In computing, cache algorithms (also frequently called cache replacement algorithms or cache replacement policies) are optimizing instructions, or algorithms, that a computer program or a hardware-maintained structure can utilize in order to manage a cache of information stored on the computer. Caching improves performance by keeping recent or often-used data items in a memory locations that are faster or computationally cheaper to access than normal memory stores. When the cache is full, the algorithm must choose which items to discard to make room for the new ones.
Least recently used (LRU), discards the least recently used items first. It has a fixed size(for limit memory usages) and O(1) time lookup.
type MapDriver ¶
type MapDriver struct {
// contains filtered or unexported fields
}
MapDriver is based on DocDriver and use LruDriver to provide caching at its interface layer. The size of LruDriver is always 1024.