Micro Focus QTP (UFT) Forums
programmatically clear cache - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: programmatically clear cache (/Thread-programmatically-clear-cache)



Clearing Cache programmatically - Monika - 02-07-2008

Hello,
Is there a way to programmatically clear cache in QTP ?
I'm dealing with a Webapp, and I use webutil.deletecookies to clear cookies. Anything for clearing cache?

Thanks,
Monika


RE: programmatically clear cache - kanimozhi - 02-07-2008

Hi,
Is it working fine? we also having so many problems regarding
cookies.


RE: Clearing Cache programmatically - Ankur - 02-18-2008

Instead of clearing cache everytime , you can set a one time option of disabling cache from Tools > Internet options > Temporary Internet Files and set the amount of disk space =1 .
Since IE 6 requires the cache space to be greater than 1 MB no pages will be stored from now on.


RE: programmatically clear cache - Munna.Sarfraz - 11-15-2011

Code:
Sub DeleteCache()
Dim root
Set root = CreateObject("FPC.Root")
Dim server
Dim cacheDrives
Dim cacheDrive
Dim fso
Set server = root.GetContainingServer()
server.StopFirewallService()
Set cacheDrives = server.CacheDrives
Set fso = CreateObject("Scripting.FileSystemObject")
For Each cacheDrive In cacheDrives
    cacheFilePath = CacheDrive.Name & "\urlcache\Dir1.cdat"
    fso.DeleteFile cacheFilePath
Next
server.StartFirewallService()
End Sub