cache

package
v0.0.0-...-d26fc85 Latest Latest
Warning

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

Go to latest
Published: May 2, 2015 License: BSD-3-Clause Imports: 6 Imported by: 4

Documentation

Overview

Package cache provides caching. All data that can be loaded once into memory is dealt with in this package. To use it, a call to LoadCache() shall be made once at the start of the application. After the data is loaded into memory, it can be accessed with the getters functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFeatures

func GetFeatures() []model.Feature

GetFeatures returns a slice containing all features.

func GetFeaturesNames

func GetFeaturesNames() map[string]struct{}

GetFeaturesNames returns a map of features names. It can be used to check in O(1) if a feature exists by providing its name as a key to the map.

func GetScoresMatrix

func GetScoresMatrix() *mx.Sparse

GetScoresMatrix returns the scores matrix from cache. Each row of the matrix corresponds to a user whereas each column corresponds to a feature. The scores matrix is closely related to the users vector. Row 'i' of the scores matrix corresponds to the scores for each feature for the user at row 'i' in the users vector.

func GetStats

func GetStats() model.Stats

GetStats provides database statistics.

func GetUsersVector

func GetUsersVector() []model.User

GetUsersVector returns the vector of users from cache. Important: the vector is sorted, matching the rows of the scores matrix. In other words, user at position 'i' in the slice corresponds as the scores for each feature at row 'i' of the scores matrix.

func LoadCache

func LoadCache(db *sql.DB) error

LoadCache loads all cacheable data into memory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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