# MX\_WEBCACHE
> [HTML Version](mx_webcache.htm)
_Added October 2016_
**xcall MIAMEX, MX\_WEBCACHE, 0, status**
**xcall MIAMEX, MX\_WEBCACHE, 1, status**
**xcall MIAMEX, MX\_WEBCACHE, 2, status, url**
**xcall MIAMEX, MX\_WEBCACHE, 3, status, url**
**xcall MIAMEX, MX\_WEBCACHE, 4, status, url, localfile**
**xcall MIAMEX, MX\_WEBCACHE, 5, status \{,wildspec\}**
MX\_WEBCACHE (MIAMEX 188) provides operations related to A-Shell's web cache feature.
This function has both a [subroutine and a print tab implementation](subroutine-print-pairs.htm.md).
**Parameters**
_opcode_ ([Num](num.htm.md)) \[in\]
Determines operation as described below.
_status_ (Signed [Num](num.htm.md)) \[in/out\]
Sets or returns options, or returns status codes shown under option 4 below.
_url\$_ ([String](string.htm.md)) \[in\]
Specifies a web directory for ocodes 2 and 3, and a fully qualified file URL for opcode 4. Currently the only URL schemes supported are http:// and https://. An optional :port may be appended to the end. Examples:
http://www.mysite.com/webrepo
http://www.mysite.com/webrepo/myfile.run:10080
https://www.mysite.com/my web repository
**Opcodes**
Opcode 0 retrieves the current webcache options in status. Status flags (defined in [ASHINC:HOOK.DEF](https://bitbucket.org/microsabio/soslib/src/master/907016/hook.def)) :
| **Symbol** | **Value** | **Description** |
|------|------|------|
| WCDF\_ENABLED | \&h00000001 | web cache enabled (else disabled) |
| WCDF\_PROG | \&h00000002 | download/cache programs (RUN,LIT,SBX) |
| WCDF\_OPENI | \&h00000004 | download/cache files on open for input |
| WCDF\_LOOKUP | \&h00000008 | download/cache any file on LOOKUP or SIZE[xs](keyword-types.htm.md) |
| WCDF\_DLL | \&h00000010 | download DLLs to bin or webcache |
| WCFG\_ALL | \&h000000FE | all flags except WCDF\_ENABLE |
Opcode 1 sets the webcache options to the value status.
Opcode 2 and 3 retrieve and set webcache url (web directory), respectively. Status will return 0 for success.
Opcode 4 performs a manual download from the specified _url\$_ to the specified _localfile\$_. If the _url\$_ is just a file.ext and the webcache url directory has been previously set, then the two are combined to form the complete source url. If _localfile\$_ is "", the source file.ext is used. If _localfile\$_ does not contain a directory, then the local webcache directory (%miame%\\webcache) is used. Returned Status will equal the # of bytes downloaded if successful, else an error code:
| **Status** | **Meaning** |
|------|------|
| \-1 | Unsupported URL scheme (e.g. not http:// or https://) |
| \-2 | Specified URL does not contain filename (Opcode 2) |
| \-3 | URL too long |
| \-4 | Unable to connect to host web server |
| \-5 | Error sending HTTP GET command to server |
| \-6 | Error in local webcache directory\\file spec |
| \-7 | Response from web server missing header terminator |
| \-8 | Response from web server not recognizable |
| \-9 | Transmission problem receiving header |
| \-### | HTTP response error code (converted to negative) |
Opcode 5 clears the local webcache directory. If the wildspec\$ parameter is specified and non-blank, only those files matching the wildspec\$ will be cleared; otherwise all of the files in the cache will be cleared. Returned status will equal the number of files removed from the cache.
**See Also**
• [AG\_WEBCACHE](ag_webcache.htm.md)
**History**
2016 October, A-Shell 6.3.1529 and 1531: [WEBCACHE](webcache.htm.md) function added to A-Shell.