cache

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cache 开始全系统增加缓存功能 目前的缓存实现流程是 在缓存包里增加业务同名方法函数,进行缓存的处理 这里目前有个问题 就是产生数据修改的时候没有强制性的修改缓存,可能会出现漏掉清理缓存而产生的数据不一致的问题

Index

Constants

This section is empty.

Variables

View Source
var Cache *cache.Cache

Cache 缓存的全局变量 @since 0.0.4

View Source
var (
	CacheOpen bool
)

CacheOpen debug 模式不开启缓存 @since 0.0.4

Functions

func Get

func Get(preKey CacheKeyPrefix, key string) (interface{}, bool)

Get 获取缓存的二次封装方法 @since 0.0.4

func GetNavMenu

func GetNavMenu(termID uint64) (*model.NavMenu, error)

GetNavMenu termID 通过缓存的形式获取菜单组信息 @since0.0.6

func GetOption

func GetOption(k string) string

GetOption 获取配置项 @since 0.0.4

func GetPost

func GetPost(id uint64) (*model.DBPost, error)

GetPost id @since 0.0.4

func GetPostmetas

func GetPostmetas(postID uint64) (map[string]model.DBPostmeta, error)

GetPostmetas post_id @since 0.0.4

func GetTerm

func GetTerm(termID uint64) (*model.DBTerm, error)

GetTerm term_id @since 0.0.4

func GetTermTaxonomy

func GetTermTaxonomy(termID uint64) (*model.DBTermTaxonomy, error)

GetTermTaxonomy term_id @since 0.0.4

func Register

func Register()

Register 注册缓存 @since 0.0.4

func Set

func Set(preKey CacheKeyPrefix, key string, value interface{})

Set 方便操作的设置缓存 @since 0.0.4

Types

type CacheKeyPrefix

type CacheKeyPrefix string

CacheKeyPrefix 缓存 Key 前缀 @since 0.0.4

const (
	// DBOptions options
	DBOptions      CacheKeyPrefix = "options_"
	NavMenu        CacheKeyPrefix = "navMenu_"
	DBTermTaxonomy CacheKeyPrefix = "term_taxonomy_"
	DBPost         CacheKeyPrefix = "posts_"
	DBTerm         CacheKeyPrefix = "terms_"
	DBPostmeta     CacheKeyPrefix = "postmeta_"
)

@since 0.0.4

func (CacheKeyPrefix) String

func (p CacheKeyPrefix) String() string

String 实际值 @since 0.0.4

Jump to

Keyboard shortcuts

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