Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { // 是否开启压缩。压缩后能减小数据量,但压缩过程会耗时。 // 如果原数据长度很长,压缩耗时要比查询耗时低得多,此时开启压缩功能是最佳选择。 // 但如果原数据长度较短,压缩或不压缩,整体耗时区别不大。 // 是否开启压缩,需要自行测试抉择。 Compressed(yes bool) // 初始化,用来迁移数据库 / 表,和一些与数据库有关的前期准备工作 Init() error // 当前请求是否已缓存过,如果缓存过,则返回缓存中的响应 IsCached(key string) ([]byte, bool) // 将没有缓存过的请求保存到缓存中 Cache(key string, val []byte) error // 清除全部缓存 Clear() error }
type CacheModel ¶ added in v0.1.4
func (CacheModel) TableName ¶ added in v0.1.4
func (CacheModel) TableName() string
type MySQLCache ¶ added in v0.1.4
type MySQLCache struct {
Host, Port, Database, Username, Password string
// contains filtered or unexported fields
}
func (*MySQLCache) Cache ¶ added in v0.1.4
func (mc *MySQLCache) Cache(key string, val []byte) error
func (*MySQLCache) Clear ¶ added in v0.1.4
func (mc *MySQLCache) Clear() error
func (*MySQLCache) Compressed ¶ added in v0.1.4
func (mc *MySQLCache) Compressed(yes bool)
func (*MySQLCache) Init ¶ added in v0.1.4
func (mc *MySQLCache) Init() error
type PostgreSQLCache ¶ added in v0.1.4
type PostgreSQLCache struct {
Host, Port, Database, Username, Password, SSLMode, TimeZone string
// contains filtered or unexported fields
}
func (*PostgreSQLCache) Cache ¶ added in v0.1.4
func (pc *PostgreSQLCache) Cache(key string, val []byte) error
func (*PostgreSQLCache) Clear ¶ added in v0.1.4
func (pc *PostgreSQLCache) Clear() error
func (*PostgreSQLCache) Compressed ¶ added in v0.1.4
func (pc *PostgreSQLCache) Compressed(yes bool)
func (*PostgreSQLCache) Init ¶ added in v0.1.4
func (pc *PostgreSQLCache) Init() error
type RedisCache ¶ added in v0.1.4
func (*RedisCache) Cache ¶ added in v0.1.4
func (rc *RedisCache) Cache(key string, val []byte) error
func (*RedisCache) Clear ¶ added in v0.1.4
func (rc *RedisCache) Clear() error
func (*RedisCache) Compressed ¶ added in v0.1.4
func (rc *RedisCache) Compressed(yes bool)
func (*RedisCache) Init ¶ added in v0.1.4
func (rc *RedisCache) Init() error
type SQLiteCache ¶ added in v0.1.4
type SQLiteCache struct { URI string // contains filtered or unexported fields }
func (*SQLiteCache) Cache ¶ added in v0.1.4
func (sc *SQLiteCache) Cache(key string, val []byte) error
func (*SQLiteCache) Clear ¶ added in v0.1.4
func (sc *SQLiteCache) Clear() error
func (*SQLiteCache) Compressed ¶ added in v0.1.4
func (sc *SQLiteCache) Compressed(yes bool)
func (*SQLiteCache) Init ¶ added in v0.1.4
func (sc *SQLiteCache) Init() error
Click to show internal directories.
Click to hide internal directories.