Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0
Ce dépôt a été archivé le 2022-05-07. Vous pouvez voir ses fichiers ou le cloner, mais pas ouvrir de ticket ou de demandes d'ajout, ni soumettre de changements.
nyaa-pantsu/cache/cache.go
akuma06 ad3a44e2f8 Torznab fix (#1019)
* Torznab fix

Added multiple category search
Fixed issues in #1017
Now category from searchParam & torrentParam are arrays of category
New Struct Categories

* Fix travis error due to database code
2017-06-18 08:30:12 +10:00

34 lignes
698 o
Go

package cache
import (
"github.com/NyaaPantsu/nyaa/cache/memcache"
"github.com/NyaaPantsu/nyaa/cache/nop"
"github.com/NyaaPantsu/nyaa/common"
"github.com/NyaaPantsu/nyaa/config"
"github.com/NyaaPantsu/nyaa/model"
)
// Cache defines interface for caching search results
type Cache interface {
Get(key common.SearchParam, r func() ([]model.Torrent, int, error)) ([]model.Torrent, int, error)
ClearAll()
}
// Impl cache implementation instance
var Impl Cache
func Configure(conf *config.CacheConfig) (err error) {
switch conf.Dialect {
/*case "native":
Impl = native.New(conf.Size)
return
*/
case "memcache":
Impl = memcache.New()
return
default:
Impl = nop.New()
}
return
}