Caching

In Symbian OS v9.3 and earlier, index entries were stored in a single index file in a permanent file store and the entire file was loaded into RAM on start up. In Symbian^3 index entries are stored in an SQL database and only the most recently used index entries are cached in RAM.

The following figure shows how a client request is completed using the cache functionality in the Message Server.

Figure 1. Caching architecture

Creating and maintaining free space in memory

Memory allocation to the cache is done incrementally, to reduce the Message Server start up time. When the Message Server starts, only a percentage of the maximum cache size ( MsvMaximumCacheSize ) is allocated to cache. The percentage is specified by the MsvInitialCacheCreation parameter. The next iteration of memory allocation is not initiated until the memory threshold (set using the MsvCacheThreshold parameter) is reached. The subsequent memory allocation is always done by a low priority active object.

Example

The memory allocation strategy is illustrated in the following figures, based on the default values (shown in the preceding table).

When Message Server starts, the cache is created with an initial size of 410KB (40 percent of 1024KB). If 70 percent of the free space in the cache gets used the server allocates an additional 205KB (20 percent of 1024).

Message Server can make two further 205KB allocations which it does as use reaches 70 percent of the memory already allocated.

If more than 70 percent of the first two allocated memory chunks is used, an additional 20 percent of memory is added to the free space.