views:

1403

answers:

3

PHP has a number of opcode caches, which as i understand it are scripts that handle the caching aspects of an application. Is there something similar for classic asp, especially something that does not require component installation?

Regarding the IIS caching behaviour, it seems from reading here that the behaviour is relevant to some sort of pre-compilation step rather than finished pages. please correct me if i am wrong

+2  A: 

Looking at your comments to the answers here so far and at your edit of your question you seem a little confused over caching.

There are two types of caching we could be be talking about.

  • Opcode or Template caching
  • Output caching

Opcode or Template caching is the caching that takes place when a raw script file which is merely a text file is transformed to an in memory set of opcodes that can be executed by the script engine. PHP has some additional tools which allow such a set of opcodes be reused when the script file is requested subsequently. Similarly ASP keeps a cache of 'compilied' opcodes in memory and on disk so that it can serve subsequent requests for the same script without going through the whole parsing process again.

Output caching is where the generated output of script that is sent to a response buffer is cached so that subsequent requests for an identical URL (and possible matching other headers as well) would not re-run the script at all but resend the previously cached output.


ASP has no facility for output caching whereas ASP.NET does. I'm not familiar enough with PHP or its normal platforms to comment on whether such a facility is available for it.

You can configure ASPs 'opcode' caching (which it calls template caching) in IIS manager (IIS6) open the properties window on the Web Sites node go to home directory tab and click Configuration... then select the cache options tab. By default 500 'compilied' pages will be cached in memory and 2000 will be cached on disk.


In a comment to my original version of this answer you seem to asking whether PHP hosted by IIS would also benefit from template caching. That would depend how PHP is added to the platform.

I hardly know anything about PHP but I would imagine it is simply another dll which IIS script mapping maps files with the extension PHP to. That being that case it won't be benefiting from ASPs template caching.

The following is probably fiction but just to try to round out the picture:-

Another unlikely possiblity would be if PHP were some how added as ASP Script language. In this case files with PHP extension would be mapped to the ASP.DLL and the files would either contain <%@ language="PHP" or the default language in the application configuration would be set to PHP. In this unlikely set up ASP would build a template that would be cached, however whether that template contains 'compilied' opcode etc would be up to PHP.

AnthonyWJones
Thank you for your comment. Is this a behaviour limited to asp or does IIS do this for any type of webpage (e.g. PHP)? Also, is this caching perhaps on a per-user basis (opcode+session)? I have used IIS a lot and have seen no indication of op-caching behaviour. Do you have any link describing it?
Alexandros Marinos
+1  A: 

It depends on what you mean by "cache".

In IIS 6.0 there is template caching, described here (MS Windows 2003 TechCenter):

"ASP processes the templates or template files that contain ASP scripts. ASP stores these templates in a template cache and then serves the cached templates for subsequent client requests. Caching ASP templates enhances performance and scalability, because cached templates are not compiled each time they are called."

You can find other distinctions of caching here.

A simple mechanism for data caching is presented in this article about Improving ASP Performance With Data Caching:

"Unfortunately there is no built in caching system in classic ASP, but it is easy to build one by using the Application object to store data. As such the techniques described in this article can be used to bring useful performance enhancements to legacy websites where upgrading the database or porting the code to ASP.NET is not a viable option."

splattne
The question _does_ define what is meant by cache, the opcode cache, the equivalent for which is the template caching that ASP does.
AnthonyWJones
Thank you for your answer. As you see there is a contradiction between the quotes. "Caching ASP templates enhances performance and scalability" vs. "there is no built in caching system in classic ASP" In my uysage i have seen no caching behaviour by IIS also. Is there a way to resolve this?
Alexandros Marinos
Sorry Alexandros, I over-read that word ("opcode"). I think template caching as described by AnthonyWJones is the mechanism you were looking for.
splattne
+1  A: 

Maybe this class helps you caching some stuff.

http://www.webdevbros.net/2006/11/18/cache-object-for-classic-asp/

It does not require any installed components and uses the application object as storage. Therefore the same cache is used by all ALL your visitors. You can use it for scenarios like e.g: Caching a heavy SQL query, ...

Michal