ADO.NET provider for Kintone / Caching
In This Topic
    In This Topic

    Caching data provides various advantages like faster data access and minimizing the calls to API which improves the overall process. The DataConnector supports an easy-to-use caching procedure where several connections can also share the cache.

    User can set necessary connection properties to enable caching feature. For example, Cache Tolerance property that ensures data fetched from the database is the latest version and Cache Location property which is the location in physical drive.

    The default tolerance of the stale data in cache is 600 seconds and the default location is %AppData%/C1DataConnector.

    The below code example implements caching the table, by setting Use Cache to True which is False by default, in the file specified by the Cache Location property of the connection string.

    Copy Code
    const string Username = "*******";
    const string Password = "********";
    const string Url = "";
    static string kintoneConnection = string.Format($@"Username={0};Password={1};Url={2};", Username, Password, Url);        
    static string connectionString = $@"{kintoneConnection};Use Cache = true; Cache Tolerance = 500; Cache Location = 'C:\temp\c1cache.db';";
    static void Main(string[] args)
        Console.WriteLine("Start Time " + DateTime.Now);
        using (C1KintoneConnection conn = new C1KintoneConnection(connectionString))
            var cmd = conn.CreateCommand();
            cmd.CommandText = "SELECT * from Products";
            var rdr = cmd.ExecuteReader();
            while (rdr.Read())
                Console.WriteLine(String.Format("\t{0} --> \t\t{1}-->\t\t\t{2}", rdr["Name"], rdr["Updated_By"], rdr["Quantity"]));
            Console.WriteLine("End Time " + DateTime.Now);