// NewShard initializes a new shard.
// The capacity is the initial capacity of the shard.
// The entrysize defines the size each entry takes.
// Smaller entries are no problem, but bigger will result in an error.
// Expires defines the time after items can be removed.
// If expires is smaller or equals 0 it will be ignored and
// items wont be removed automatically.
NewShard initializes a new shard.
The capacity is the initial capacity of the shard.
The entrysize defines the size each entry takes.
Smaller entries are no problem, but bigger will result in an error.
Expires defines the time after items can be removed.
If expires is smaller or equals 0 it will be ignored and
items wont be removed automatically.
// NewShard initializes a new shard . // The capacity is the initial capacity of the shard . // The entrysize defines the size each entry takes . // Smaller entries are no problem but bigger will result in an error . // Expires defines the time after items can be removed . // If expires is smaller or equals 0 it will be ignored and // items wont be removed automatically .
func NewShard(capacity, entrysize uint64, expSrv ExpirationService) *Shard {
	shrd := &Shard{
		ptrs:      intmap.New(),
		freePtrs:  NewPointerQueue(),
		size:      0,
		entrysize: entrysize,
		array:     make([]byte, capacity),
		expSrv:    expSrv,
	}
	return shrd
}
func NewShard ( capacity , entrysize uint64 , expSrv ExpirationService ) * Shard { shrd := & Shard { ptrs : intmap . New ( ) , freePtrs : NewPointerQueue ( ) , size : 0 , entrysize : entrysize , array : make ( [ ] byte , capacity ) , expSrv : expSrv , } return shrd }
NewShard initializes a new shard.
NewShard initializes a new shard .