Browse Source

Swap to an LRU cache set to 20MB

kegan/cache-rss-feeds
Kegan Dougal 8 years ago
parent
commit
e088e11821
  1. 4
      src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

4
src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
log "github.com/Sirupsen/logrus"
"github.com/die-net/lrucache"
"github.com/gregjones/httpcache"
"github.com/matrix-org/go-neb/database"
"github.com/matrix-org/go-neb/matrix"
@ -220,7 +221,8 @@ func itemToHTML(feed *gofeed.Feed, item gofeed.Item) matrix.HTMLMessage {
}
func init() {
cachingClient = httpcache.NewMemoryCacheTransport().Client()
lruCache := lrucache.New(1024*1024*20, 0) // 20 MB cache, no max-age
cachingClient = httpcache.NewTransport(lruCache).Client()
types.RegisterService(func(serviceID, serviceUserID, webhookEndpointURL string) types.Service {
r := &rssBotService{
id: serviceID,

Loading…
Cancel
Save