Thanks Jason. I will take your suggestion.
But your hint about beaker caching is helpful.

cheers
-Bkumar

On Jun 5, 4:22 pm, Jason <[email protected]> wrote:
> On Tuesday, June 5, 2012 7:49:10 AM UTC-4, Learner wrote:
>
> > Hello Pyramid gurus,
>
> > I have been searching for quick tutorials on caching, background jobs
> > & ORM related topics. I found quite a few resources which seem to be
> > very informative. Since I am new to both Python & Pyramid, I thought I
> > will seek experienced people opinion, before I go ahead and use
> > anything I found on web. Any help is very much appreciated.
>
> > 1. Caching:
> >     The simple use case is:- I want to show top 10 or 20 articles on
> > my wiki application. Before I render the data I would like to cache
> > the db result upon first query execution and cache it. Cache to
> > refresh automatically after every 1 hour or so.
> > As far as caching is concerned you will be better off caching the result
>
> of your view. Beaker cache has decorators for caching individual
> functions/methods for a specified period of time (look for cache_region
> decorator) this way not only will the database results be cached, but also
> the processing required to turn them into the template values. I don't know
> if there is a way to also cache the rendered template with Pyramid.
>
> > 2. Background Jobs: I am using SQLAlchemy in my application. All the data
> > needed for the application comes from XML/CSV files. Is there any way in
> > Pyramid I can create a background job and schedule it to run every 30
> > minutes or so?. Job will look at one particular folder everytime it is run,
> > and if there are any xml/csv files job will pick it up and process them.
> > Since this is simple ETL job, SQLAlchemy is not aware of the DB changes. So
> > does this confuse any of the ORM caching mechanism and show the dirty data?
> > If so, how would I be able to notify ORM to rebuild its caching? Thanks for
> > your time.
>
> Are the XML files parsed and then the data is inserted into a database that
> Pyramid uses? Perhaps a cron job would be better suited to that?  If you
> are using caching then the data will not be refreshed in Pyramid until the
> cache refreshes. If you are using beaker you can force the cache to refresh
> on the next hit.
>
> Are you sure you need all this caching though? It seems unnecessarily
> complicated. Pyramid is very fast, SQLAlchemy is very fast, your database
> will probably be caching the query plans as well so it's going to be very
> fast. I would recommend building your application with no caching, and then
> adding it later if it is needed. That way you can worry about getting the
> loaded data displaying correctly (especially since you're data setup is a
> little more complex) before having to figure out a caching system.
>
> -- Jason

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to