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



El vie, 11-03-2011 a las 13:54 +0100, Juan A. Suárez Romero escribió:
> On Fri, 2011-03-11 at 11:27 +0100, Víctor M. Jáquez L. wrote:
> > Comments below
> > 
> > > +  g_object_class_install_property (g_klass,
> > > +                                   PROP_IDENTIFIER,
> > > +                                   g_param_spec_string ("identifier",
> > > +                                                        "GrlNet identifier",
> > > +                                                        "Unique identifier for GrlNet",
> > > +                                                        NULL,
> > > +                                                        G_PARAM_READWRITE |
> > > +                                                        G_PARAM_CONSTRUCT_ONLY |
> > > +
> > >                                                          G_PARAM_STATIC_STRINGS));
> 
> > Why should we demand to the API user a cache identifier? I guess we could
> > figure out one with out messing the user.
> 
> 
> The identifier is used to create a place where to store the cached data.
> 
> Right now, the place is ~/.cache/<applicationname>/<identifier>
> 
> <applicationname> is easier to get without asking the user
> (g_get_prgname())
> 
> But identifier is not.
> 
> 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?

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?

> 
> 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?

Iago



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