Jump to content


Sample - Directory


  • Please log in to reply
1 reply to this topic

#1 Guest_sdevadas_*

Guest_sdevadas_*
  • Guests

Posted 30 January 2008 - 08:41 AM

In the sample - Directory,

The readthrough trigger doesnt seem to be implemented.

So there is a method,

public Hashtable LoadFromSource(string[] keys, ref ExpirationHint[] exh, ref EvictionHint[] evh)
{
throw new Exception("The method or operation is not implemented.");
}

Is this why - when I change the XMLDataSource file, the cache doesnt detect this, but just gives me what is in its memory. Restarting the cache gives the modified value of course.

Could you suggest a way I can trigger external changes to the XMLDataSource file to be deteced in LoadFromSource?

Or provide the .sql file to create this database and install the trigger in a SQL server, so I can run the sample fully (including seeing the read-through happen when external changes are made).

Thanks

#2 Guest_Paul_*

Guest_Paul_*
  • Guests

Posted 31 January 2008 - 09:16 AM

Is this why - when I change the XMLDataSource file, the cache doesnt detect this, but just gives me what is in its memory.


LoadFromSource method of the readthru provider code is called in following cases (if you have implemented and specified the provider):
1. You call Get and the item is not found in the cache
2. An item in the cache expires and its ResyncExpiredItem property is true

So, implementation of this method doesnt directly relates to detection of changes in file.

Could you suggest a way I can trigger external changes to the XMLDataSource file to be deteced in LoadFromSource?


What you should do is:

1. If you are adding items to cache directly, create a CacheItem, specify a File dependency and specify its isResyncExpiredItems property as true before adding it to cache
(please see NCache Help: Developing with NCache > Using Cache Dependency > Using File Dependency)

This will expire the item when file changes, and call readthru provider's LoadFromSource.

2. Implement LoadFromSource so that it creates required object from XML file and sets its expirationHint again as above (please see sample for sql provider for how to do this)

provide the .sql file to create this database and install the trigger in a SQL server, so I can run the sample fully


Please look in NCache Help for:
1. Using DB Cache Dependency or Using SqlYukon Dependency (for SQL Server 2005)
2. Sample Applications

Please contact support@alachisoft.com for more details.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users