Documentation ¶
Index ¶
- type Cache
- func (c *Cache) CacheFromData(data []byte, name string) (string, error)
- func (c *Cache) CacheFromReader(reader io.Reader, name string) (string, error)
- func (c *Cache) GetNameFromURL(surl string) string
- func (c *Cache) GetPathForName(name string) (path, dir string)
- func (c *Cache) GetURLForName(name string) string
- func (c *Cache) HandlerWithCheckToken(h http.Handler) http.Handler
- func (c *Cache) IsCached(name string) bool
- func (c *Cache) RemoveFileWithName(name string) error
- func (c Cache) ServeHTTP(w http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct { WorkDir string GetURL string ServeEmptyImage bool DeleteAfter time.Duration // Delete files when modified more than this long ago UseToken bool // Not implemented DeleteRatio float32 // When deleting files, only do some of sub-folders (randomly) each time 0.1 is do 10% of them at random NestInHashFolders bool InterceptServeFunc func(w http.ResponseWriter, req *http.Request, file *string) bool // return true if handled // contains filtered or unexported fields }
func (*Cache) CacheFromData ¶
CacheFromData reads in data, using name as filename, or hash of data, and extension This string return is this name/hash, used to get a path or a url for fetching. This should really call CacheFromReader, not visa versa
func (*Cache) CacheFromReader ¶
CacheFromReader reads bytes from reader with stype png or jpeg and caches is with CacheFromData This name is used to get a path or a url for getting
func (*Cache) GetNameFromURL ¶
func (*Cache) GetPathForName ¶
func (*Cache) GetURLForName ¶
func (*Cache) HandlerWithCheckToken ¶
func (*Cache) RemoveFileWithName ¶
Click to show internal directories.
Click to hide internal directories.