Documentation ¶
Index ¶
- Constants
- Variables
- func RemoveScores(items []Scored) []string
- type Database
- type NoDatabase
- func (NoDatabase) AppendList(prefix, name string, items ...string) error
- func (NoDatabase) ClearList(prefix, name string) error
- func (NoDatabase) Close() error
- func (NoDatabase) GetInt(prefix, name string) (int, error)
- func (NoDatabase) GetList(prefix, name string) ([]string, error)
- func (NoDatabase) GetScores(prefix, name string, begin, end int) ([]Scored, error)
- func (NoDatabase) GetString(prefix, name string) (string, error)
- func (NoDatabase) GetTime(prefix, name string) (time.Time, error)
- func (NoDatabase) IncrInt(prefix, name string) error
- func (NoDatabase) SetInt(prefix, name string, val int) error
- func (NoDatabase) SetScores(prefix, name string, items []Scored) error
- func (NoDatabase) SetString(prefix, name, val string) error
- func (NoDatabase) SetTime(prefix, name string, val time.Time) error
- type Redis
- func (r *Redis) AppendList(prefix, name string, items ...string) error
- func (r *Redis) ClearList(prefix, name string) error
- func (r *Redis) Close() error
- func (r *Redis) GetInt(prefix, name string) (int, error)
- func (r *Redis) GetList(prefix, name string) ([]string, error)
- func (r *Redis) GetScores(prefix, name string, begin, end int) ([]Scored, error)
- func (r *Redis) GetString(prefix, name string) (string, error)
- func (r *Redis) GetTime(prefix, name string) (time.Time, error)
- func (r *Redis) IncrInt(prefix, name string) error
- func (r *Redis) SetInt(prefix, name string, val int) error
- func (r *Redis) SetScores(prefix, name string, items []Scored) error
- func (r *Redis) SetString(prefix, name, val string) error
- func (r *Redis) SetTime(prefix, name string, val time.Time) error
- type Scored
Constants ¶
const ( IgnoreItems = "ignore_items" ItemNeighbors = "item_neighbors" UserNeighbors = "user_neighbors" CollaborativeRecommend = "collaborative_recommend" CTRRecommend = "ctr_recommend" PopularItems = "popular_items" LatestItems = "latest_items" LastModifyItemTime = "last_modify_item_time" // the latest timestamp that a user related data was modified LastModifyUserTime = "last_modify_user_time" // the latest timestamp that an item related data was modified LastUpdateUserRecommendTime = "last_update_user_recommend_time" // the latest timestamp that a user's recommendation was updated LastUpdateUserNeighborsTime = "last_update_user_neighbors_time" // the latest timestamp that a user's neighbors item was updated LastUpdateItemNeighborsTime = "last_update_item_neighbors_time" // the latest timestamp that an item's neighbors was updated // GlobalMeta is global meta information GlobalMeta = "global_meta" DataImported = "data_imported" LastFitRankingModelTime = "last_fit_match_model_time" LastRankingModelVersion = "latest_match_model_version" )
Variables ¶
var ErrNoDatabase = fmt.Errorf("no database specified")
var ErrObjectNotExist = fmt.Errorf("object not exists")
Functions ¶
func RemoveScores ¶
RemoveScores resolve items for a slice of ScoredItems.
Types ¶
type Database ¶
type Database interface { Close() error SetScores(prefix, name string, items []Scored) error GetScores(prefix, name string, begin int, end int) ([]Scored, error) ClearList(prefix, name string) error AppendList(prefix, name string, items ...string) error GetList(prefix, name string) ([]string, error) GetString(prefix, name string) (string, error) SetString(prefix, name string, val string) error GetTime(prefix, name string) (time.Time, error) SetTime(prefix, name string, val time.Time) error GetInt(prefix, name string) (int, error) SetInt(prefix, name string, val int) error IncrInt(prefix, name string) error }
Database is the common interface for cache store.
type NoDatabase ¶
type NoDatabase struct{}
NoDatabase means no database used for cache.
func (NoDatabase) AppendList ¶
func (NoDatabase) AppendList(prefix, name string, items ...string) error
AppendList method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) ClearList ¶
func (NoDatabase) ClearList(prefix, name string) error
ClearList method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) Close ¶
func (NoDatabase) Close() error
Close method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) GetInt ¶
func (NoDatabase) GetInt(prefix, name string) (int, error)
GetInt method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) GetList ¶
func (NoDatabase) GetList(prefix, name string) ([]string, error)
GetList method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) GetScores ¶
func (NoDatabase) GetScores(prefix, name string, begin, end int) ([]Scored, error)
GetScores method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) GetString ¶
func (NoDatabase) GetString(prefix, name string) (string, error)
GetString method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) GetTime ¶
func (NoDatabase) GetTime(prefix, name string) (time.Time, error)
GetTime method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) IncrInt ¶
func (NoDatabase) IncrInt(prefix, name string) error
IncrInt method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) SetInt ¶
func (NoDatabase) SetInt(prefix, name string, val int) error
SetInt method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) SetScores ¶
func (NoDatabase) SetScores(prefix, name string, items []Scored) error
SetScores method of NoDatabase returns ErrNoDatabase.
func (NoDatabase) SetString ¶
func (NoDatabase) SetString(prefix, name, val string) error
SetString method of NoDatabase returns ErrNoDatabase.
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis cache storage.
func (*Redis) AppendList ¶
AppendList appends a list of scored items to Redis.