Documentation ¶
Index ¶
- Constants
- func Cache(store CStore, expire time.Duration) gin.HandlerFunc
- type CStore
- type DBStore
- func (c *DBStore) Add(key string, value interface{}, expires time.Duration) error
- func (c *DBStore) Decrement(key string, delta uint64) (uint64, error)
- func (c *DBStore) Delete(key string) error
- func (c *DBStore) Flush() error
- func (c *DBStore) Get(key string, value interface{}) (err error)
- func (c *DBStore) GetBytes(key string) (ret []byte, err error)
- func (c *DBStore) Increment(key string, delta uint64) (uint64, error)
- func (c *DBStore) Replace(key string, value interface{}, expires time.Duration) error
- func (c *DBStore) Set(key string, value interface{}, expires time.Duration) (err error)
- func (c *DBStore) SetBytes(key string, value []byte, expires time.Duration) (err error)
- type DBStoreItem
- type FileStore
- func (c *FileStore) Add(key string, value interface{}, expires time.Duration) error
- func (c *FileStore) Decrement(key string, delta uint64) (uint64, error)
- func (c *FileStore) Delete(key string) error
- func (c *FileStore) Flush() error
- func (c *FileStore) Get(key string, value interface{}) error
- func (c *FileStore) Increment(key string, delta uint64) (uint64, error)
- func (c *FileStore) Replace(key string, value interface{}, expires time.Duration) error
- func (c *FileStore) Set(key string, value interface{}, expires time.Duration) error
- type ResponseCache
Constants ¶
View Source
const ( // DEFAULT ... DEFAULT = time.Duration(0) // FOREVER ... FOREVER = time.Duration(-1) // CacheMiddlewareKey ... CacheMiddlewareKey = "gincontrib.cache" )
View Source
const ( CacheExpireShort = 1 * time.Hour CacheExpireMedium = 6 * time.Hour CacheExpireLong = 24 * time.Hour CacheExpireExtra = 7 * 24 * time.Hour TMDBKey = "com.tmdb." TVDBKey = "com.tvdb." TraktKey = "com.trakt." LibraryKey = "library." FanartKey = "fanart." OpensubtitlesKey = "osdb." TMDBEpisodeKey = TMDBKey + "episode.%d.%d.%d.%s" TMDBEpisodeExpire = CacheExpireLong TMDBFindKey = TMDBKey + "find.%s.%s" TMDBFindExpire = CacheExpireLong TMDBCountriesKey = TMDBKey + "countries.%s" TMDBCountriesExpire = CacheExpireLong TMDBLanguagesKey = TMDBKey + "languages.%s" TMDBLanguagesExpire = CacheExpireLong TMDBMovieImagesKey = TMDBKey + "movie.%d.images" TMDBMovieImagesExpire = CacheExpireLong TMDBMovieByIDKey = TMDBKey + "movie.%s.%s" TMDBMovieByIDExpire = CacheExpireLong TMDBMovieGenresKey = TMDBKey + "genres.movies.%s" TMDBMovieGenresExpire = CacheExpireLong TMDBMoviesIMDBKey = TMDBKey + "imdb.list.%s.%d.%d" TMDBMoviesIMDBExpire = 24 * time.Hour TMDBMoviesIMDBTotalKey = TMDBKey + "imdb.list.%s.total" TMDBMoviesIMDBTotalExpire = 24 * time.Hour TMDBMoviesTopMoviesKey = TMDBKey + "topmovies.%s.%s.%s.%s.%d.%d" TMDBMoviesTopMoviesExpire = 24 * time.Hour TMDBMoviesTopMoviesTotalKey = TMDBKey + "topmovies.%s.%s.%s.%s.total" TMDBMoviesTopMoviesTotalExpire = 24 * time.Hour TMDBSeasonKey = TMDBKey + "season.%d.%d.%s.%t" TMDBSeasonExpire = CacheExpireLong TMDBSeasonImagesKey = TMDBKey + "show.%d.%d.images" TMDBSeasonImagesExpire = CacheExpireLong TMDBShowByIDKey = TMDBKey + "show.%d.%s" TMDBShowByIDExpire = CacheExpireLong TMDBShowImagesKey = TMDBKey + "show.%d.images" TMDBShowImagesExpire = CacheExpireLong TMDBShowGenresKey = TMDBKey + "genres.shows.%s" TMDBShowGenresExpire = CacheExpireLong TMDBShowsTopShowsKey = TMDBKey + "topshows.%s.%s.%s.%s.%d.%d" TMDBShowsTopShowsExpire = 24 * time.Hour TMDBShowsTopShowsTotalKey = TMDBKey + "topshows.%s.%s.%s.%s.total" TMDBShowsTopShowsTotalExpire = 24 * time.Hour TMDBEpisodeImagesKey = TMDBKey + "show.%d.%d.%d.images" TMDBEpisodeImagesExpire = CacheExpireLong TraktActivitiesKey = TraktKey + "last_activities.%s" TraktActivitiesExpire = 30 * 24 * time.Hour TraktListActivitiesKey = TraktKey + "list_activities.%s.%s" TraktListActivitiesExpire = 30 * 24 * time.Hour TraktPausedLastUpdatesKey = TraktKey + "PausedLastUpdates.%d" TraktPausedLastUpdatesExpire = 30 * 24 * time.Hour TraktMovieKey = TraktKey + "movie.%s" TraktMovieExpire = CacheExpireLong TraktMovieByTMDBKey = TraktKey + "movie.tmdb.%s" TraktMovieByTMDBExpire = CacheExpireLong TraktMoviesByCategoryKey = TraktKey + "movies.%s.%s.%d" TraktMoviesByCategoryExpire = 24 * time.Hour TraktMoviesByCategoryTotalKey = TraktKey + "movies.%s.total" TraktMoviesByCategoryTotalExpire = 24 * time.Hour TraktMoviesWatchlistKey = TraktKey + "movies.watchlist" TraktMoviesWatchlistExpire = CacheExpireLong TraktMoviesCollectionKey = TraktKey + "movies.collection" TraktMoviesCollectionExpire = CacheExpireLong TraktMoviesListKey = TraktKey + "movies.list.%s" TraktMoviesListExpire = CacheExpireExtra TraktMoviesCalendarKey = TraktKey + "movies.calendar.%s.%s.%d" TraktMoviesCalendarAllExpire = CacheExpireLong TraktMoviesCalendarMyExpire = CacheExpireShort TraktMoviesCalendarTotalKey = TraktKey + "movies.calendar.%s.total" TraktMoviesCalendarTotalExpire = CacheExpireLong TraktMoviesWatchedKey = TraktKey + "movies.watched" TraktMoviesWatchedExpire = CacheExpireLong TraktMoviesPausedKey = TraktKey + "movies.paused" TraktMoviesPausedExpire = CacheExpireLong TraktShowKey = TraktKey + "show.%s" TraktShowExpire = CacheExpireLong TraktShowsByCategoryKey = TraktKey + "shows.%s.%s.%d" TraktShowsByCategoryExpire = 24 * time.Hour TraktShowsByCategoryTotalKey = TraktKey + "shows.%s.total" TraktShowsByCategoryTotalExpire = 24 * time.Hour TraktShowsWatchlistKey = TraktKey + "shows.watchlist" TraktShowsWatchlistExpire = CacheExpireLong TraktShowsWatchedKey = TraktKey + "shows.watched" TraktShowsWatchedExpire = CacheExpireLong TraktShowsPausedKey = TraktKey + "shows.paused" TraktShowsPausedExpire = CacheExpireLong TraktShowsCollectionKey = TraktKey + "shows.collection" TraktShowsCollectionExpire = CacheExpireLong TraktShowsListKey = TraktKey + "shows.list.%s" TraktShowsListExpire = CacheExpireExtra TraktShowsCalendarKey = TraktKey + "shows.calendar.%s.%s.%d" TraktShowsCalendarAllExpire = CacheExpireExtra TraktShowsCalendarMyExpire = CacheExpireLong TraktShowsCalendarTotalKey = TraktKey + "shows.calendar.%s.total" TraktShowsCalendarTotalExpire = CacheExpireLong TraktShowsHiddenProgressKey = TraktKey + "shows.hidden.progress" TraktShowsHiddenProgressExpire = CacheExpireLong TraktSeasonsKey = TraktKey + "seasons.%d" TraktSeasonsExpire = CacheExpireLong TraktSeasonsExtendedKey = TraktKey + "seasons.%d.extended" TraktSeasonsExtendedExpire = CacheExpireLong TraktSeasonKey = TraktKey + "season.%d.%d" TraktSeasonExpire = CacheExpireLong TraktEpisodeKey = TraktKey + "episode.%d.%d.%d" TraktEpisodeExpire = CacheExpireLong TraktEpisodeByIDKey = TraktKey + "episode.id.%s" TraktEpisodeByIDExpire = CacheExpireLong TraktEpisodeByTMDBKey = TraktKey + "episode.tmdb.%s" TraktEpisodeByTMDBExpire = CacheExpireLong TraktEpisodeByTVDBKey = TraktKey + "episode.tvdb.%s" TraktEpisodeByTVDBExpire = CacheExpireLong TraktWatchedMoviesKey = TraktKey + "movies.watched.list" TraktWatchedMoviesExpire = CacheExpireLong TraktWatchedShowsKey = TraktKey + "shows.watched.list" TraktWatchedShowsExpire = CacheExpireLong TraktWatchedShowsProgressKey = TraktKey + "progress.watched.%d" TraktWatchedShowsProgressExpire = CacheExpireLong TraktWatchedShowsProgressWatchedKey = TraktKey + "progress.episodes.watched.%d" TraktWatchedShowsProgressWatchedExpire = CacheExpireLong TraktShowTMDBKey = TraktKey + "show.tmdb.%s" TraktShowTMDBExpire = CacheExpireLong TraktShowTVDBKey = TraktKey + "show.tvdb.%s" TraktShowTVDBExpire = CacheExpireLong TraktLockedAccountKey = TraktKey + "locked.account" TraktLockedAccountExpire = 24 * time.Hour TVDBShowByIDKey = TVDBKey + "show.%d.%s" TVDBShowByIDExpire = CacheExpireLong FanartMovieByIDKey = FanartKey + "movie.%d" FanartMovieByIDExpire = CacheExpireLong FanartShowByIDKey = FanartKey + "show.%d" FanartShowByIDExpire = CacheExpireLong LibraryStateKey = LibraryKey + "State.%s" LibraryStateExpire = 30 * 24 * time.Hour LibraryWatchedPlaycountKey = LibraryKey + "WatchedLastPlaycount.%s" LibraryWatchedPlaycountExpire = 30 * 24 * time.Hour LibraryShowsLastUpdatesKey = LibraryKey + "showsLastUpdates" LibraryShowsLastUpdatesExpire = 7 * 24 * time.Hour LibraryResolveFileKey = LibraryKey + "Resolve_File_%s" LibraryResolveFileExpire = 60 * 24 * time.Hour LibrarySyncPlaycountKey = LibraryKey + "SyncLastPlaycount.%s" LibrarySyncPlaycountExpire = 30 * 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CStore ¶
type CStore interface { Get(key string, value interface{}) error Set(key string, value interface{}, expire time.Duration) error Add(key string, value interface{}, expire time.Duration) error Replace(key string, data interface{}, expire time.Duration) error Delete(key string) error Increment(key string, data uint64) (uint64, error) Decrement(key string, data uint64) (uint64, error) Flush() error }
CStore ...
type DBStore ¶
type DBStore struct {
// contains filtered or unexported fields
}
func NewDBStore ¶
func NewDBStore() *DBStore
NewDBStore Returns instance of BoltDB backed cache store
type DBStoreItem ¶
type DBStoreItem struct { Key string `json:"key"` Value interface{} `json:"value"` }
Click to show internal directories.
Click to hide internal directories.