This is a migrated thread and some comments may be shown as answers.

disable second level cache

3 Answers 79 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Diana
Top achievements
Rank 1
Diana asked on 04 Mar 2016, 05:41 PM

Hello!
We develop WPF and implemented data Access 2015.1.225.1 with cache level two, in some case we don't use information cache, we need data base information, configuring back-end over write SeconLevel property in false (SecondLevelCache.Enabled = false;)

However, data returned correspond with cache information.
How get data base information without set nocache value to entity in Cache Policy property (Cache Policy: NoCache)?

Thanks!

3 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 07 Mar 2016, 01:25 PM
Hi Diana,

do you want to fetch the data fresh from the database, avoiding stale data in the cache?
Then you should either configure your database context instance so that no second level cache is used.
Or remove the content from the second level cache via context.LevelTwoCache.Evict() method.
Or is the issue that the data gets stale in the first place: Then you would need to configure second level cache synchronization. See

http://docs.telerik.com/data-access/developers-guide/crud-operations/working-with-second-level-cache/data-access-tasks-enable-second-level-cache-enable-code

for more information.

Alternatively you could open a second database connection with a different backend configuration and use this non-caching database for the code parts that need fresh information. However, I would not recommend this as it easily leads to confusion and the data is still stale in the caching connection potentially.

Regards,
Thomas
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.

 
0
Diana
Top achievements
Rank 1
answered on 07 Apr 2016, 11:07 PM

Hi Thomas, 

How  remove the content from the second level cache via context.LevelTwoCache.Evict() method?.

thanks for your help!

0
Thomas
Telerik team
answered on 08 Apr 2016, 01:54 PM
Hello Diana,

the context.LevelTwoCache.Evict() is the method to evict the second level cache and all content will be removed from it. 

Regards,
Thomas
Telerik
 
Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Tags
Data Access Free Edition
Asked by
Diana
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Diana
Top achievements
Rank 1
Share this question
or