Ah i see. So basically if we have an expensive operation, like a DB call (as
an example), we would have to re-do it every time we use the Vmod function
inside the VCL.  The issue i am having is i have a vmod, where i would like
to return a complex struct but i cant seem to be able to do that due to
limitations on the return types.  So i was planning on writing accessor
methods (one for each element of the struct) but for each accessor, i would
need to re-query the database to get the value which was trying to avoid.

Example:

typedef struct  _mydata {
 int val1;
 int val2;
} mydata ;

 i would love to return mydata from the vmod, but instead i need to write
vmod_get_int1, vmod_get_int2 to get at these.  The issue is to populate this
struct is "expensive".  Is there a better way around this issue ?

Cheers.



On Mon, Sep 12, 2011 at 5:48 PM, Poul-Henning Kamp <[email protected]>wrote:

> In message <
> canzwjw5t+q0iea-5rn6xriuy6kw7i8auq-z_vgj5ubkw9_g...@mail.gmail.com>
> , AD writes:
>
> > I am trying to use the PRIV_CALL capability of the vmods in order to
> cache
> >an expensive operation used later in the vcl itself.
>
> That is not how it works.
>
> PRIV_CALL is for caching things for the next time this call is executed.
>
> The canonical example is a caching a compiled regexp.
>
> What you need is a "PRIV_SESS" or "PRIV_REQ" variable, and I'm beating
> my head against the wall trying to find the best way to implement
> that as we're speaking...
>
>
> --
> Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
> [email protected]         | TCP/IP since RFC 956
> FreeBSD committer       | BSD since 4.3-tahoe
> Never attribute to malice what can adequately be explained by incompetence.
>
> _______________________________________________
> varnish-misc mailing list
> [email protected]
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
_______________________________________________
varnish-misc mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

Reply via email to