Exemple #1
0
// later, this can be lazily init, after database connection established
func init() {
	Cache = &StaticCache{
		Account: &AccountCache{
			oldId: cache.NewLRU(cacheSize),
			nick:  cache.NewLRU(cacheSize),
			id:    cache.NewLRU(cacheSize),
		},
		Session: &SessionCache{
			session: cache.NewLRU(cacheSize),
		},
		Channel: &ChannelCache{
			id:        cache.NewLRU(cacheSize),
			groupName: cache.NewLRU(cacheSize),
		},
		Message: &MessageCache{
			id: cache.NewLRU(cacheSize),
		},
		Participant: &ParticipantCache{
			id: cache.NewLRU(cacheSize),
		},
	}
}
Exemple #2
0
// NewTTL returns an in-memory cache with the specified
// ttl expiration period.
func NewLRU(size int) Cache {
	return cache.NewLRU(size)
}
Exemple #3
0
	"strings"
	"time"

	mgo "gopkg.in/mgo.v2"

	"github.com/koding/cache"
)

var (
	flagMongoConn = flag.String("mongo", "", "mongo connection string")
	flagSkip      = flag.Int("s", 0, "Configuration profile from file")
	flagLimit     = flag.Int("l", 1000, "Configuration profile from file")
	flagDry       = flag.Bool("dry", false, "dry run")
	flagColls     = flag.String("colls", "jUsers,jAccounts,jWorkspaces,jNames,jComputeStacks,jCombinedAppStorages,relationships", "collections to clean up")

	deletedGroupBySlug  = cache.NewLRU(10000)
	existingGroupBySlug = cache.NewLRU(10000)

	deletedAccountByID    = cache.NewLRU(10000)
	existingAccountByID   = cache.NewLRU(10000)
	existingAccountByNick = cache.NewLRU(10000)
	deletedAccountByNick  = cache.NewLRU(10000)

	deletedUserByID    = cache.NewLRU(10000)
	existingUserByID   = cache.NewLRU(10000)
	existingUserByNick = cache.NewLRU(10000)
	deletedUserByNick  = cache.NewLRU(10000)
	deadline           = time.Date(2016, time.January, 1, 0, 0, 0, 0, time.UTC)
)

func initialize() {
Exemple #4
0
func newDefaultStorage() *defaultStorage {
	return &defaultStorage{
		cache: cache.NewLRU(2000),
	}
}