For those who occasionally read my blog, you should know that we still have some applications written in classic ASP.
One of the problems of the ASP is the lack of method of caching.
The only ways to cache data are to write files to disk or mount information in the application object.
So we decided to create a COM object to enable the ASP to communicate with Memcached.
I found on the official list of clients, a good C# client called Memcached BEIT.
With this implementation in C #, it becomes quite easy to create a COM component.
There are some limitations: it can only send simple data types or arrays. But it’s not need trying to send a recordset, the system will fail to serialize.
You can download the archive containing the sources here.
An example of a call from an asp or vbs script:
1 | set oMemcache = createobject("memcacheCOM.memcache") |
In order to use the COM component, you need to do the following things:
compile the project
verify that your ASP server has .net framework 2.0 installed
copy the file named memcacheCOM.dll on your ASP server (no need to put it in system32 or GAC)
in a command prompt, run :
1 | c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe path_of_memcacheCOM.dll\memcacheCOM.dll /codebase |
From this moment you should be able to connect to memcached from your asp or vbs scripts.
But we must also do something, because under load you may encounter the following error:
ErrorCode ASP 0177: 8000ffff
Description Server.CreateObject Failed
It’s a known issue with Microsoft Updates, just do the following things:
give the IUSR (or whoever your site is running as) Read access to HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones
After applying the workaround, unregister and re-register the MemcacheCOM component and recycle the IIS app pool.
Thanks to ceTe Software moderator for the workaround:
http://www.cete.com/Forums/DisplayThread.csp?ForumId=39&ThreadId=2785