Smart Cache is default configured as follows:
If you installed the JRE1.1 start Java with jre -cp .
command
instead only java
. If you are installed JDK1.2 use
oldjava
command instead. (Note: You can also make .jar file see
Making Java 1.2+ .jar file, Section 7.7)
All other parameters remain the same.
Starting Smart Cache is easy:
java -ms1m scache
If all works Smart Cache starts and you will see something like this:
Smart Cache 0.41 - full featured caching proxy server and web forwarder Copyright (c) Radim Kolar 1998-9. Open source software; There is NO warranty. See the GNU General Public License version 2 or later for copying conditions. Wed Sep 01 15:53:14 GMT+02:00 1999 Smart Cache 0.41 ready.
This is the most obscure feature of SC. You do not need to understand what it does or even use it. (I also do not use it, because I am too lazy). If you want to cleanly shutdown cache - just create a file with its name as set in the shutdown_flag or immediate_shutdown_flag directive and wait about 3 minutes. If not, press CTRL-C/Close Window/Kill process.
Smart Cache can make also 'fast shutdown', which is still better than killing the Smart Cache process (via CTRL-C). Keyword immediate_shutdown_flag sets the name of this flag file and keyword flag_check_interval sets, how often (in sec.) SC checks for this flag. Use this if you do not want to wait.
Flag file can be created on Unix systems with touch <filename> command, in Windows environment use for example
echo > c:\name\of\shutdown\flag or mkdir c:\name\of\shutdown\flag
Flag file is nothing special, SC checks only if some file with specified filename exists. Directory with specified name can be also used (this is easier to create under Windows).
After some time of inactivity, the cache will be stopped. If some users use SC, no shutdown will occur.
Smart Cache updates every 3 minutes .cacheinfo files, which holds information about directory contents. If .cacheinfo is bad, no/some files in directory will not be found. If you look into SC output, you will see how many .cacheinfo files was updated in message XX - directories saved. If you see 0 dirs saved and you are not using SC, no .cacheinfo contains out-of-date information, so you can kill SC process without harming anything. Also if you are just browsing offline, only outdated information in .cacheinfo files is Last Access Date, which is used only by GC, so killing SC will not harm your data.
If your cache is getting large, you may want to run the garbage collection process. This process scans the entire cache and finds old or bad files and deletes them until specified cache size is reached.
Garbage collections also checks and repair the cache integrity, so you don't
need to use -killunref to delete unreferenced files. Edit the
gc.cnf
file and run it with java scache -gc
Garbage collection can be run, while proxy server is still running, there is no need for stopping it. See also Configuration of garbage collection, Section 4.2 and Smart Cache maintenance, Section 5.5.
Smart Cache needs no special maintenance except Running garbage collection, Section 5.4
In some rare cases (mainly due to improper cache shutdown) there can be some orphan files (files without any reference) in the cache. These can be located and deleted using the java scache -killunref command. These files are very rare and takes very few diskspace, so there is no need to worry about them.
Nowadays this command is obsolete and has been replaced by the garbage collector. Use this command only if you want to delete this unreferenced files and do not perform garbage collection. This operation is about 2-3 times faster than garbage collection.
There is also repair utility, which does better job than -killunref because -killunref delete unreferenced files but repair add this files to cache.
Repair procedures summary:
Smart Cache has a builtin URL filter. This filter was designed to eliminate ADV. banners, because they slow down browsing a lot, and other unwanted stuff which WWW browsers downloads without asking (for example .AVI files in web pages. Netscape downloads it even if do not have plugin for them.).
Filter in controlled by two fail.cnf and pass.cnf configuration files. In first file, you can find list of BLOCKED URLs and list of UNBLOCKED in second. Files has the same syntax - write one URL mask per line, you can use wildchar '*' in expected way. SC will detects when you edit this files and reload it without needing to restart.
When SC got request for a particular URL, it will look in pass.cnf first. If requested URL is one of them, SC will skip following tests and displays it. If requested URL is not found in pass.cnf SC will look into fail.cnf. If requested URL is there, SC will abort request otherwise request will be allowed.
When SC encounters a blocked URL, error 403 Forbidden by rule will be displayed. You can display any custom URL instead, many people uses some images, which will appear on places of ADV. banners. You can use any picture from net, SC will cache this, so it will not be downloaded more times.
ErrorDocument 403 http://some.site.with.nice.images.com/images/nature/bluesky.gif
Other people likes blank image instead. Famous 43 byte long 1x1 transparent GIF is now hardcoded in SC and can be used with:
ErrorDocument 403 0
In some cases you may got unwanted Forbidden by rule errors. You have two choices for their eliminating:
Example: You want to access site http://ad.astra.com/, but you
can't do that because Smart Cache has a default entry http://ad.* in
fail.cnf
file, which deny access to this server. You do not want
to remove this entry from fail.cnf
, because it unlocks many ADV.
banners. Solution is add http://ad.astra.* to pass.cnf
file.
You can also turn of announcing blocked URLs to console by directive fail_trace. This is useful if you are using a complex "fail.cnf" with a lot of entries and can't fiddle out if or why some request has been blocked.
hsn@cybermail.net