cache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

cache パッケージは http のキャッシュ機構を提供します.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Trans []Tx `json:"transactions"`
	// contains filtered or unexported fields
}

Cache は http のキャッシュ機構を提供します.

func New

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

New は新しい Cache を作成します.

func (*Cache) GetLastTransaction

func (c *Cache) GetLastTransaction() (*Tx, error)

GetLastTransaction は最後に作成されたトランザクションを返します.

func (*Cache) GetTransaction

func (c *Cache) GetTransaction(name string) (*Tx, error)

GetTransaction は指定されたトランザクションを返します.

func (*Cache) NewTransaction

func (c *Cache) NewTransaction() (*Tx, error)

新しいトランザクションを作成します.

type File

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

File は http.Request に対応したキャッシュファイルを表します.

func (*File) IsExists

func (f *File) IsExists() bool

IsExists はキャッシュファイルがあるかを返します.

func (*File) Load

func (f *File) Load() (*http.Response, error)

Load はキャッシュファイルから http.Response を返します.

func (*File) Store

func (f *File) Store(resp *http.Response) error

Store はキャッシュファイルに http.Response の内容を保存します.

type Tx

type Tx struct {
	Name     string `json:"name"`
	CreateAt string `json:"create_at"`
	// contains filtered or unexported fields
}

Tx はトランザクションを表します.

func (*Tx) NewFile

func (tx *Tx) NewFile(req *http.Request) (*File, error)

NewFile は http.Request に対応した File を作成します.

Jump to

Keyboard shortcuts

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