Re: [Cache V2 1/1] grl-net: Use libsoup cache



On Fri, 2011-03-11 at 14:07 +0100, Iago Toral Quiroga wrote:
> > Why we need it? Because as each plugin uses its own GrlNet instance,
> > which in turns uses its own libsoup instance, Sergio (the guy who
> worked
> > in libsoup cache) suggested me to avoid writting in the same
> directory,
> > as one instance could overwrite cache from other instances, leading
> to
> > unexpected behaviour (sic).
> 
> What about having Grilo create a single instance of this cache and
> handing it to the plugins on demand os all the plugins share the cache
> instance? Would this make sense?

Maybe creating a single instance and sharing it across all plugins would
make sense. The point is that it would require changes in all plugins.

The point is that, as Victor mentioned, right now the user gets the
content from GrlNet after a request, and this content is freed by GrlNet
when a new request is made.

If the instance is shared across different plugins, we would need to
return a copy of content, so it is not freed by the instance in another
plugin. And this will require to change all plugins to free the content.

Maybe this is something we should really do, because i'm not sure if
this "free when a new request is done" approach is safe (just figure out
invoking two times in a row a browse() operation).


> Also, with the current approach of having one cache per app+plugin
> combination, my understanding is that we need one identifier per
> source,
> right? can't this be the source id for example?, since each app has
> its
> own directory, wouldn't that be enough?

Yes, that is what I'm doing right now. All plugins invoke
grl_net_wc_new(SOURCE_ID).

Victor asked if we can get the same by invoking grl_net_wc_new().


> 
> > 
> > Of course, I could create a random identifier instead asking the
> user.
> > But the point is that users generally quit the program, without
> turning
> > down the plugins, and thus grl_net_wc_finalize() is almost never
> > invoked, so the cache becomes there. So if i use a random
> identifier, i
> > will fill the cache with lots of files.
> 
> This can be fixed if plugins remove the cache file on start-up, right?
> 

The point is how plugins know what are the random name they used in a
previous execution? They can't get rid of all directories in the cache,
as maybe the cache is actually in use by another plugin.


	J.A.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]