AutoQuery InMemory caching

I’d like to use AutoQuery against a “cached” repository in order to avoid extra db access.
My idea is to load all db rows once at the start up, having autoquery working against this “cached/InMemory” repository and reload the cached repository on a regular basis.

At the present I’m considering to use the built-in InMemory Ormlite factory filled with db entries.

public override void Configure(Container container)
	//Config examples
	this.Plugins.Add(new AutoQueryFeature
		MaxLimit = Int32.MaxValue,
		EnableRawSqlFilters = true,
		UseNamedConnection = "readonly",
		IllegalSqlFragmentTokens = { "ProtectedSqlFunction" },
	//this.Plugins.Add(new CorsFeature());

	var sqlDbFactory = new OrmLiteConnectionFactory(

	var inMemoryDbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
	sqlDbFactory.RegisterConnection("readonly", inMemoryDbFactory);


	using (var db = inMemoryDbFactory.Open())
	using(var realDb = sqlDbFactory.Open())
		if (db.CreateTableIfNotExists<Poco>())
			foreach (var c in realDb.Select<Poco>())

what do you think about it?
Is there any built-in alternative to accomplish the same goal?

Yep should be a workable solution for small datasets that can fit into the App Servers memory and you’re fine with stale data in-between periodic syncs.

Thanks a lot for your reply&toughts.
Is there any other built-in alternative?
If not, are you planning to add it also including an auto-refresh strategy?

Built in alternative? No there’s no plan to develop an in-memory RDBMS alternative to Sqlite or any kind of cross-RDBMS auto-sync solution which wouldn’t belong in the framework and very few people would use.

The only solution SS could provide a better story around for this is caching, something which currently requires implementing the AutoQuery method and adding caching like we do in TechStacks AutoQuery Services:

//Cached AutoQuery
public object Any(FindTechnologies request)
    var key = "{0}/{1}".Fmt(typeof(GetTechnology).Name, Request.QueryString);
    return base.Request.ToOptimizedResultUsingCache(Cache, key, () =>
        var q = AutoQuery.CreateQuery(request, Request.GetRequestParams());
        return AutoQuery.Execute(request, q);

But this is very different to an in-memory database as caching only helps when you have many requests for the same query since subsequent hits can be served from the cache.