Managing concurrent accesses to a cache
View Patent ↗Various embodiments of the present invention allow concurrent accesses to a cache. A request to update an object stored in a cache is received. A first data structure comprising a new value for the object is created in response to receiving the request. A cache pointer is atomically modified to point to the first data structure. A second data structure comprising an old value for the cached object is maintained until a process, which holds a pointer to the old value of the cached object, at least one of one of ends and indicates that the old value is no longer needed.
1. A method for allowing concurrent accesses to a cache, the method comprising:
receiving a request to update an object stored in a cache;
creating, in response to receiving the request, a first data structure comprising a new value for the object;
atomically modifying a cache pointer to point to the first data structure; and
maintaining a second data structure comprising an old value for the object until a process, which holds a pointer to the old value of the object, at least one of ends and indicates that the old value is no longer needed.
2. The method of claim 1 , further comprising:
receiving a request to add a new object to the cache;
creating a third data structure comprising the new object; and
atomically modifying a cache pointer to point to the third data structure.
3. The method of claim 1 , further comprising:
receiving a request to delete an existing object from the cache;
atomically modifying a pointer associated with the existing object, the atomically modifying preventing the existing object from being accessible by searching the cache; and
maintaining a data structure comprising a value for the existing object until a process holding a pointer to the existing object one of ends and indicates that the value is no longer needed.