Skip to content
Hüseyin Tuğrul BÜYÜKIŞIK edited this page Sep 29, 2021 · 3 revisions

Setting multiple values with local synchronization:

    let pairs = [];
    for(let j=0;j<N_concurrency;j++)
    {
        pairs.push({key:5, value:100});
    }

    for(let i=0;i<N_access;i+=N_concurrency)
    {
        let values = await cache.setMultipleAwaitable(... pairs);    
    }

All key-value pairs ({key:foo, value:bar}) in the pairs array are processed asynchronously and they all join in a Promise that is awaitable.


Getting multiple values with local synchronization:

    let keys = [];
    for(let j=0;j<N_concurrency;j++)
    {
        keys.push(Math.random());
    }

    for(let i=0;i<N_access;i+=N_concurrency)
    {
        let values = await cache.getMultipleAwaitable(... keys);    
    }

Clone this wiki locally