This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
I don't understand how or when the cache is used. I have the tables Currencies and Languages which I query on every page request in a web app. Every time I load the page I can see a SELECT * being sent in the logs, followed by a bunch of "Setting entity into cache [Currency [Id=5c9e8d50-1ab1-4020-9918-1716d414c7f0, EntityState=New]]". The tables both have Cached=true set in the designer, so why aren't they fetched from the cache? |
|
|
The tables both have lazy-loaded one-many and many-one relationships, if that matters. It's actually a chain of three tables Currencies <- Countries.CurrencyId <- Languages.CountryId. Preferrably I'd like all three tables to exist in memory most of the time, since they are small and fairly static. I was hoping I could just set the caching attribute and make that work magically :) |
|
|
Hi robbam :) The caching in LightSpeed only extends to caching entities by Id. e.g. If you were fetching an entity through a to one association, or loading an entity through UnitOfWork.FindOne<T>(id); So unfortunately the behavior you are looking for is not what is currently provided with the caching. What you are looking for would be a query cache, where the result of a given query is cached as a result set. Given the situation here, it sounds like what would be the ideal solution would be for the table to be cached (given you know they are small and I presume are being used like reference data), so for the queries to be loaded from cache rather than by querying the database. This is actually something we are already looking to improve on, so I will see if we can move this up the backlog a bit for 3.0 :)
Jeremy |
|
|
Thanks for the clarification :) It's not a big deal right now, I could just keep them in a static property or something. |
|