[Try it] A Script to Clear web-proxy cache

Hello,

For everyone who want to clear proxy cache, try the follwing scripts.


1- add thescript

if you have ver 3.x then use: (tested and works!)

/system script add name=script_clear_cache source="/ip proxy clear-cache"

if you have ver 2.x (not tested)

/system script add name="script_clear_cache " source={
/ip firewall nat disable [find action=redirect]
/ip web-proxy set enabled=no
/ip web-proxy clear-cache
/ip web-proxy set enabled=yes
/ip firewall nat enable [find action=redirect]
}

2-scheduler
now we come to the scheduler: which will run the script (script_clear_cache)

/system scheduler
add comment="" disabled=no interval=1d name=clear_proxy_cache on-event=script_clear_cache  start-date=Jan/01/1970 start-time=00:00:00

Note her: interval=1d

this is the interval for the script to run, i use it everyday. if you want it weekly just use: interval=7d for monthly user: interval=30d

The start date: start-date=Jan/01/1970 is the date when the script to start. you can use future date like: sep/30/2009 etc..

good luck everybody

just interesting: why do you need that?..

Maybe I’m missing something here, but couldn’t you just set

max-fresh-time (time; default: 3d) - an upper limit on how long objects without an explicit expiry
time will be considered fresh

to 1 day and have objects expire from the cache dynamically without needing a script?

It would be good that the clean does after coming to a certain volume. In case of the SD it would take better of the useful life. (memory celds)

regards

better?.. why?..

vanilla kernel does not good management on memories of limited use. It’s not performed fot that. That’s why after reaching the top of capacity, there was a drain, not to be writing constantly on the same cells.

regards

I think Script is required as the dynamic expiry seems to fail. My webproxy is set to 3d max fresh however when I look in proxy contents there are many objects over 7 days old and more, or am I missing something