SQLite In-Memory Database?

3 posts, 0 answers
  1. Michael
    Michael avatar
    12 posts
    Member since:
    Dec 2010

    Posted 01 Oct 2015 Link to this post


    i have a project where i load a complete sqlite database with about 1000 entries with telerik dataaccess and the fluent framework. Then i build a radtreeview, a breadcrump and a datagridview from this data. Now the annoying part. Every change needs to be done in the database immediatly. For ease of coding i then do "GetAll" to load my data again from the DB and build my views. The other choice would be to load my trees asynchronously what sounds like a lot of work.

    I've made a few tests: first i saved the database on my pretty slow laptop hdd. It takes about 0,5-1 seconds to reload everything after a change has been done. Then i moved the sqlite file to my ssd. The speed is about 20 times as high, while my program is still on the laptop hdd. So i'm ​pretty sure this clumsiness is created because telerik writes every change of my 75kb database synchronously directly on the disk.

    So my question is: is it possible to let the file be opened and hold completly in the memory and write a copy of it locally asynchronously? Like this: https://www.sqlite.org/inmemorydb.html

    Should be much faster then my local laptop hd.  


  2. Michael
    Michael avatar
    12 posts
    Member since:
    Dec 2010

    Posted 01 Oct 2015 Link to this post

    I found a solution myself. Im doing it with the secondlevel cache:


    m_backendConfiguration.SecondLevelCache.Enabled = true;
    m_backendConfiguration.SecondLevelCache.Strategy = CacheStrategy.All;
    m_backendConfiguration.SecondLevelCache.NumberOfObjects = 10000;
    m_backendConfiguration.SecondLevelCache.NumberOfObjectsPerQueryResults = 10000;
    m_backendConfiguration.SecondLevelCache.NumberOfQueryResults = 10000;

  3. DevCraft banner
  4. Boris Georgiev
    Boris Georgiev avatar
    190 posts

    Posted 05 Oct 2015 Link to this post

    Hi Ronald,

    You are on the right track. Using the second level cache is the right solution for your scenario. In this set of documentation articles you could find more information about the second level cache and how you can use it.

    Feel free to contact us if you have any other questions.

    Boris Georgiev
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Back to Top