Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I don't think you'll be able to do this, as I don't think this sort of thing is what the callback mechanism was designed for. I can see what you're trying to achieve, and I can see how you've arrived at this question, but I think as long as your client uses the cache-aside pattern everywhere you're touching the cache you'll get the effect. </p> <p>For review, the cache-aside pattern is:</p> <ul> <li>Check the cache for the desired item </li> <li>If the item is NOT in the cache <ul> <li>Get the item (from whatever source e.g. database, web service) </li> <li>And put it into the cache </li> <li>Return the item to the caller </li> </ul></li> <li>If the item IS in the cache <ul> <li>(Cast it to the expected type) </li> <li>Return the item to the caller</li> </ul></li> </ul> <p>e.g.</p> <pre><code>Order order; // Check to see if the order is in the cache Object cachedOrder = m_cache.Get(OrderId.Text); if (cachedOrder == null) { // The order is NOT in the cache, so get it from the web service order = OrderWebservice.Get(OrderId.Text); // Cache the order for 10 seconds m_cache.Add(OrderId.Text, order, New TimeSpan(0,0,10); } else { // The order IS in the cache, so cast it order = (Order)cachedOrder; } // Return the order to the client, whether it's the cached order or the one from the web service return order; </code></pre> <p>In this way, the cached order will never be more than ten seconds old, because if it times out of the cache, the next caller will get a null result from the cache and call the web service again to get the order from the web service. You'll get the same effect, but as the cache will be filled on demand you should see a lower impact on your server as it won't be spinning up a web service request every ten seconds.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload