cache

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IPCCreate = 00001000

	IPCRMID = 0
	IPCSet  = 1
	IPCStat = 2
)

Variables

This section is empty.

Functions

func RemoveKey

func RemoveKey(key int) error

func RemoveMmap

func RemoveMmap(filePath string) error

func Shmat

func Shmat(shmid int, shmaddr uintptr, shmflg int) (uintptr, error)

shmat: map/unmap shared memory, plase see man 2 shmat. golang gc won't affect on this.

func Shmctl

func Shmctl(shmid int, cmd int, buf *ShmidDs) (int, error)

shmctl: shared memory control operations

func Shmdt

func Shmdt(shmaddr uintptr) (int, error)

shmdt: map/unmap shared memory, plase see man 2 shmdt.

func Shmget

func Shmget(key int, size int, flag int) (int, error)

shmget: get shared memort area identifier, please see man 2 shmget

Types

type Cache

type Cache interface {
	Bytes() []byte
	Close() error
}

func NewCache

func NewCache(connectionString string) (Cache, error)

NewCache returns Cache (SHM) by connectionString, connectionString indicate the shm location with uri format eg. shmkey:1228 or file:/tmp/ramdisk/bbs.shm

type Mmap

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

func CreateMmap

func CreateMmap(filePath string, size int64) (*Mmap, error)

func OpenMmap

func OpenMmap(filePath string) (*Mmap, error)

func (*Mmap) Bytes

func (m *Mmap) Bytes() []byte

func (*Mmap) Close

func (m *Mmap) Close() error

type SHM

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

func CreateKey

func CreateKey(key int, size int) (*SHM, error)

func OpenKey

func OpenKey(key int) (*SHM, error)

OpenKey open a shm which is already exists.

func (*SHM) Bytes

func (s *SHM) Bytes() []byte

func (*SHM) Close

func (s *SHM) Close() error

type ShmidDs

type ShmidDs struct {
	ShmSegsz sizeT

	ShmCpid    int32
	ShmLpid    int32
	ShmNattach shmattT
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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