If you want more than one CAS server for failover purposes, see Clustering the CAS server.
To modify CAS 2 to serialize ticket caches and restore them on initialization, the basic strategy is this:
- Modify CacheInit (a ServletContextListener) to persist the caches on shutdown, and attempt to restore them on initialization
- Storing serialized data using the Java Preferences API is easy and requires no deployment configuration, but may not scale well (e.g. if java implements the Preferences API by using the Windows Registry)
- Make Ticket as Serializable
- Make the caches Serializable
- Use custom serialization since their implementations use a WeakHashMap which is not serializable
Attached is a patch file of the differences in the code. Note that this implementation was previously modified so that 'tolerance' (timeout) is a long instead of an int in the caches.