Forum Discussion

L4L7_53191's avatar
L4L7_53191
Icon for Nimbostratus rankNimbostratus
Feb 26, 2010

pyControl v2 cache duration: do you have preferences?

All: One of the new features of pyControl 2.0.1 will be an WSDL cache of pickled WSDL objects. These can be re-used and it should speed up load times a bit.

 

 

Question: do you have a preference as to how long the default cache duration is? By default I am thinking of setting it to be a month. Our WSDLs don't change that frequently, so I am thinking that a month (or even longer) is reasonable. Please let me know if you have thoughts.

 

 

By the way, you can delete the cache directory if you want it to re-build.

 

 

Thoughts?

 

 

TIA,

 

-Matt
  • Ionut_Turturic1's avatar
    Ionut_Turturic1
    Historic F5 Account
    WSDL caching would be pretty nice. One month sounds ok, but would it be smart enough to decide whether the remote WSDL is newer than the cached one, and download it again ?

     

     

    Also a 'nocache' flag should be considered for those who don't want this feature. Last time I played with pycontrol_v1 and its cache we ran into some weird behavior because some boxes had the wrong WSDLs cached.

     

     

    -J
  • I'll definitely be adding a cache=None option here (currently enabled by default, but I'll now make a kwarg out of it) so that should be fine. Now, regarding automatically detecting a newer WSDL, the answer is no - the cache is read from disk and pyControl wouldn't be able to figure out what is newer and what is not as it's reading from disk and not checking the remote system. There are two ways to potentially address this:

     

     

    1) I already plan to add a cache flush function, probably in the utils module. This should be handy for cache rebuilds, etc.

     

    2) You can subclass the suds cache class and easily create a custom cache with specific timeout values (e.g. 0=indefinite, hours, weeks, months) values/attributes.

     

     

    Once I add the cache='blah' kwarg, 2 will be easily satisfied - I'll do some testing and give some examples in the forums, docs, and codeshare.

     

     

    Does this sound reasonable?

     

     

    -Matt