Skip to content
gqlxj1987's Blog
Go back

Ccache Intro

Edit page

原repo

CCache is an LRU Cache, written in Go, focused on supporting high concurrency.

Lock contention on the list is reduced by:

如何实现

type Cache struct {
	*Configuration
	list        *list.List
	size        int64
	buckets     []*bucket
	bucketMask  uint32
	deletables  chan *Item
	promotables chan *Item
	control     chan interface{}
}

数据存放在bucket里

type bucket struct {
	sync.RWMutex
	lookup map[string]*Item
}

CCache’s LayeredCache stores and retrieves values by both a primary and secondary key. Deletion can happen against either the primary and secondary key, or the primary key only (removing all values that share the same primary key).

双层key?


Edit page
Share this post on:

Previous Post
Clipper intro
Next Post
osgi bundle intro