On Friday, November 26, 2010, Thomas Olsen wrote:
> On Friday 26 November 2010 22:58:20 Aaron J. Seigo wrote:
> > On Friday, November 26, 2010, Thomas Olsen wrote:
> > > I'm working on a Plasma applet that uses data from Last.fm and Google
> > > Maps.
> > > 
> > > Now I have to figure out how I’m gonna the cache Last.fm feed and all
> > > the images that I’m downloading. For 3 reasons, the most important is
> > > of course
> > 
> > are you using a DataEngine for the Last.fm queries? if so, you should be
> > able to get caching (including between runs of the application) for
> > "free" that way.
> 
> Aha. I wasn't aware of that. Exploring data engines is still on my TODO
> list but definitely higher on the list now :-)

there are some techniques that make this is a lot easier (or harder ;) to 
achieve cleanly with a DataEngine. done "the plasma way" it's dead simple; but 
it seems too easy on the one hand, and the pattern is more like what one would 
hope for in service centric (aka web) programming  that most people seem to 
miss it.

i really need to write a "how to write a network centric DataEngine simply and 
get free stuff like caching for your efforts" article on techbase ....

the short story is:

* use a DataContainer subclass for each network operation
* mark them as storable with setStorageEnabled(true)
* keep track of refresh rates in the DataContainers (DataEngine offers some 
automatic limiting for you, even, with setMinimumPollingInterval)
* use the DataContainers as a way to persist information about "which request 
it was", even providing an internal mapping between an "easy to use" (and 
won't change with the web API) key and the actual URL to request; prevents 
visualization breakage, makes code in visualizations more readable, allows 
breakages due to service changes to be addressed transparently in the 
DataEngine

harrass me for more info (or that article), but that should hopefully set you 
in the right general direction

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks

Attachment: signature.asc
Description: This is a digitally signed message part.

 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to