#1 2023-03-10 19:10:23

wienani
Member
Registered: 2012-08-31
Posts: 29

Missing TSynCache.Add

Hallo Ab,

I can't find TSynCache.Add()

In Mormot 1 exist

Offline

#2 2023-03-10 23:45:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,183
Website

Re: Missing TSynCache.Add

Because in mormot 2 there is a new R/W locking mechanism which is more effecient when reading from multiple threads.
So the purpose of the class is to be .... a cache. And for a cache you only need AddOrUpdate / not Add.

If you want something more complete, don't use TSynCache but just TSynDictionary or IKeyValue<> from mormot.Core.collections.

Offline

#3 2023-03-11 06:09:45

wienani
Member
Registered: 2012-08-31
Posts: 29

Re: Missing TSynCache.Add

My purpose is for caching, I will change to AddOrUpdate. Thx u

But maybe little correction for Find() documentation, still written call Add()

   /// find a Key in the cache entries
    // - return '' if nothing found: you may call Add() just after to insert
    // the expected value in the cache

Offline

Board footer

Powered by FluxBB