CopyFileToCache


CopyFileToCache(Url, Filename: string; CacheType: DWORD; Expire: TDateTime) encapsulates the WINAPI functions CreateUrlCacheEntry and CommitUrlCacheEntry.

Use this function to add en entry to the cache, copy a file to the cache and associate it with a URL.

The following code copy the file 'C:\test.htm' to the cache, sets the expiretime of the entry to 01/01/2001 and associate it with the URL 'http:/www.urlcachetest.com/index.html'.

 

procedure TForm1.Button1Click(Sender: TObject);
var
Url, FileName, Expire : String;
ExpireDT : TDateTime;

begin
Url:='http:/www.urlcachetest.com/index.html';
FileName:='C:\test.htm';
Expire:='01-01-01 00:00:00';
ExpireDT:=StrToDateTime(Expire);
IECache1.CopyFileToCache(Url, FileName, NORMAL_CACHE_ENTRY, ExpireDT);

end;