Is there an "entity cache" machenism in persistent?

78 views
Skip to first unread message

Magicloud Magiclouds

unread,
Apr 22, 2013, 11:30:40 PM4/22/13
to yeso...@googlegroups.com
Needless to say, this is a great helper for database operation performance. Especially for some design that will request the same entity for a few times during one http request.

Just to confirm, is there one?
--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

Magicloud Magiclouds

unread,
Apr 22, 2013, 11:44:37 PM4/22/13
to yeso...@googlegroups.com
Please allow me to explain a little. I am trying to make a page that show charts based on user formulas. So there are two kind of processes:

1. parse all formulas to find out what entities are used. Then runDB them all and deal.
2. runDB for every formula and deal.

Personally, I like the second one, which is more like a flow process that work with the formula list one by one, instead of whole. But this way, same entity will be selected for a bunch of times in one http request.

Any suggestions?

Greg Weber

unread,
Apr 23, 2013, 12:01:46 AM4/23/13
to Yesod Web Framework
I don't understand your use case explanation, but the answer to your initial question is no, there is no cache in persistent (how would it be expired?).

If you are performing the same queries then you can just make sure your database is configured to cache the queries or keep the recent data in memory.

In 1.2 there will be a helper for caching data for the duration of a request.


--
You received this message because you are subscribed to the Google Groups "Yesod Web Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yesodweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Magicloud Magiclouds

unread,
Apr 23, 2013, 12:57:34 AM4/23/13
to yeso...@googlegroups.com
Well, I am using PgSQL, which AFAIK, does not cache queries.

The new feature sounds fit. May I know further information?

josejuan

unread,
Apr 23, 2013, 3:19:36 AM4/23/13
to yeso...@googlegroups.com
Hello Greg,

a cache subsystem for general purposes (not only database) is a great functionality for any server, two kind of cache is commonly used: application and session. One popular cache subsystem is http://memcached.org

Application is used to cache global objects (eg. a remote list "country mapping codes", a rendered control "tip of the day", a global value "users website summary", ...).

Session is used to cache user objects (eg. last search query, my own "tipo of the day", ...).

Over any cache subsystem you can develop all caching (explicitly or not).

I rephrase the question as "Is there any cache subsystem in Yesod?"

Sooner or later I think it will be necessary.

Than you and best regards!

Greg Weber

unread,
Apr 23, 2013, 9:45:19 AM4/23/13
to Yesod Web Framework
On Mon, Apr 22, 2013 at 9:57 PM, Magicloud Magiclouds <magicloud....@gmail.com> wrote:
Well, I am using PgSQL, which AFAIK, does not cache queries.


PgSQL does some caching/loading of recent query data, even if it isn't a direct query cache. So if your queries are on indexed fields I wouldn't worry about duplicating them. Perhaps what could actually help you though is the ability to re-use a prepared statement. Some ORMs (ActiveRecord from Rails at least) have the ability to automatically re-use prepared statements.


The new feature sounds fit. May I know further information?
 
I think I described it accurately: it is a cache that you can manually use. Please wait for the 1.2 release :)
Reply all
Reply to author
Forward
0 new messages