summaryrefslogtreecommitdiff
path: root/cache.c
Commit message (Collapse)AuthorAgeFilesLines
* core: make object cache LIFO1.6.13dormando2022-01-121-1/+1
| | | | | was originally LIFO and I broke that when switching to the queue.h code. This is friendlier for cache.
* core: cache.c cleanups, use queue.h freelistdormando2021-08-091-46/+15
| | | | | | | | | cache constructors/destructors were never used, which just ended up being wasted branches. Since there's no constructor/destructor for cache objects, we can use the memory itself for the freelist. This removes a doubling realloc for the freelist of cache objects and simplifies the code a bunch.
* Fix over-freeing in internal object cachebitground2020-10-261-1/+1
| | | | | | When returning item to the cache and the items allocated exceeded cache->limit, we should free the item and not put it to the cache. The current code will free any item that tried returned to the cache when cache->total < cache->limit which is true in most cases if the total objects has never exceeded the limit.
* add separate limits for connection buffersdormando2020-02-261-2/+17
| | | | | | | | | | | allows specifying a megabyte limit for either response objects or read buffers. this is split among all of the worker threads. useful if connection limit is extremely high and you want to aggressively close connections if something happens and all connections become active at the same time. missing runtime tuning.
* network: response stacking for all commandsdormando2020-02-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change refactors most of memcached's networking frontend code. The goals with this change: - Decouple buffer memory from client connections where plausible, reducing memory usage for currently inactive TCP sessions. - Allow easy response stacking for all protocols. Previously every binary command generates a syscall during response. This is no longer true when multiple commands are read off the wire at once. The new meta protocol and most text protocol commands are similar. - Reduce code complexity for network handling. Remove automatic buffer adjustments, error checking, and so on. This is accomplished by removing the iovec, msg, and "write buffer" structures from connection objects. A `mc_resp` object is now used to represent an individual response. These objects contain small iovec's and enough detail to be late-combined on transmit. As a side effect, UDP mode now works with extstore :) Adding to the iovec always had a remote chance of memory failure, so every call had to be checked for an error. Now once a response object is allocated, most manipulations can happen without any checking. This is both a boost to code robustness and performance for some hot paths. This patch is the first in a series, focusing on the client response.
* allow skipping thread-local cache locksdormando2017-01-071-5/+12
| | | | | suffix cache was using a generic cache system, which uses a mutex lock. the pools are per-thread however.
* totally destroy test cachesdormando2012-07-291-0/+1
| | | | | | | someone pointed out that cache_destroy wasn't freeing the cache_t pointer. memcached itself never destroys a cache it creates, so this is fine, but it's fixed for completeness...
* Issue 161 incorrect allocation in cache_createTrond Norbye2010-11-101-1/+1
|
* Fix compilation warning1.4.3Trond Norbye2009-11-041-1/+2
|
* Create a generic cache for objects of same sizeTrond Norbye2009-04-171-0/+146
The suffix pool could be thread-local and use the generic cache