posts - 19 , comments - 8 , trackbacks - 0

September 2014 Entries

Caching Dictionary
This blog describes an implementation of a local/persistent caching dictionary bringing together the classes discussed in the Heap, PersistentDictionary, and CircularBuffer blogs. Design The implementation uses an in memory dictionary and a persistent dictionary. The recently accessed items remain in the local dictionary, while the less used are moved to the persistent store. As older values are accessed they are moved back into the local store. using System; using System.Collections; using System.Collections.Generic; ......

Posted On Monday, September 1, 2014 11:52 AM | Comments (0) | Filed Under [ C# CachingDictionary caching dictionary ]

Persistent Dictionary
This blog describes the implementation of a persistent dictionary. There are a number of excellent solutions to this online, but most were highly complex. This is a simple implementation which was sufficient for my purpose. It uses the classes described in the Heap blog. The Cache First we defined the interface for the persistent cache. This follows the traditional CRUD pattern. using System; using JetBlack.Patterns.Heaps; namespace JetBlack.Patterns.Caching { public interface ICache<T> : IDisposable ......

Posted On Monday, September 1, 2014 11:13 AM | Comments (0) | Filed Under [ C# persistent dictionary PersistentDictionary ]

Heap
This post describes a heap data structure. In this implementation a heap manages a sequential array of data which grows upwards from the bottom. Blocks of this array can be allocated, freed, read and written to through handles. The heap attempts to keep itself small by managing a list of free blocks that can be reallocated. Design The primary operations handled by the heap will be memory management: Allocate and Deallocate, and reading and writing: Read and Write. As will become clear later on it ......

Posted On Monday, September 1, 2014 9:51 AM | Comments (0) | Filed Under [ C# Heap stream heap file stream heap StreamHeap FileStreamHeap ]

Circular Buffer in C#
A circular buffer is buffer of fixed length. When the buffer is full, subsequent writes wrap, overwriting previous values. It is useful when you are only interested in the most recent values. Design Goal This is a circular buffer I needed as a component for a caching layer. It is largely a blatant ripoff of the many implementations previously published on the web, with a few changes which might prove useful to those with similar objectives. My first specific requirement was to model the structure ......

Posted On Monday, September 1, 2014 9:04 AM | Comments (3) | Filed Under [ C# circular buffer ]

Powered by: