l2cache

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

local cache of memory and disk library.

when writing data size is more than limit size in New function, it will write all of the data to temporary file in New function seted directory.

Read function is streaming by offset.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Cache cache object

func New

func New(limit int, dir string) (*Cache, error)

New create cache

func (*Cache) Close

func (c *Cache) Close()

Close close cache and free data

func (*Cache) Limit

func (c *Cache) Limit() int

Limit get limit size

func (*Cache) Read

func (c *Cache) Read(data []byte) (int, error)

Read read data from cache

func (*Cache) Write

func (c *Cache) Write(data []byte) (int, error)

Write write data to cache

Jump to

Keyboard shortcuts

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