Documentation ¶
Overview ¶
cachefs实现了缓存文件系统
缓存文件系统用于在http.FileSystem默认实现需要优化 缓存文件系统在Open和Read时如果没有修改,不会进行系统调用,而是使用缓存
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buf ¶
type Buf struct {
// contains filtered or unexported fields
}
循环缓存 当到末尾是不会返回io.EoF,会下次从头读取
type CacheFs ¶
type CacheFs struct {
// contains filtered or unexported fields
}
缓存文件系统 在Open和Read时如果没有修改,不会进行系统调用,而是使用缓存
type HttpCacheFs ¶
type HttpCacheFs struct {
// contains filtered or unexported fields
}
Http缓存文件系统
Example ¶
http.Handle("/", http.FileServer(NewHttpCacheFs(`E:\前端\html`)))
Output:
func NewHttpCacheFs ¶
func NewHttpCacheFs(path string) *HttpCacheFs
创建NewHttpCacheFs path 是相对的路径 相当于http.Dir
Click to show internal directories.
Click to hide internal directories.