cache

package
v0.0.0-...-bf91d86 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2018 License: GPL-2.0, GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Dir     string
	MaxSize int
)
View Source
var Instance *gorm.DB
View Source
var TrafficCache = make(map[uint]map[string]bool)

Functions

func FolderSize

func FolderSize() int

func Load

func Load(user, password, name string) (err error)

func SizeLeft

func SizeLeft() int

Types

type Cache

type Cache struct {
	Model
	Path        string    `gorm:"Type:varchar(64);Column:path;NOT NULL;primary_key;unique" json:"path"`
	File        string    `gorm:"Type:varchar(64);Column:file;NOT NULL;primary_key;unique" json:"file"`
	ContentType string    `gorm:"Type:varchar(64);Column:content_type;NOT NULL" json:"content_type"`
	Traffics    []Traffic `json:"-"`
}

func SmallestTraffic

func SmallestTraffic() (c Cache)

func (*Cache) Create

func (c *Cache) Create(path, file, contentType string) *Cache

func (*Cache) Delete

func (c *Cache) Delete(id uint) *Cache

func (*Cache) Exists

func (c *Cache) Exists(path string) bool

type Model

type Model struct {
	ID        uint       `gorm:"primary_key" json:"id"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `gorm:"Default:null" sql:"index" json:"deleted_at"`
}

type Traffic

type Traffic struct {
	Model
	CacheID uint   `gorm:"Type:int(10) unsigned;Column:cache_id;NOT NULL;primary_key" json:"cache_id"`
	Address string `gorm:"Type:varchar(64);Column:address;NOT NULL" json:"name"`
}

func (*Traffic) Create

func (t *Traffic) Create(addr string, cacheID uint) *Traffic

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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