You can make use of Ehcache that comes with Integration Server. You do not need any terracotta license just to make use of basic caching features without distributed caching.
You can achieve the expiry feature you are looking for in Ehcache. Please refer to below link which explains on how to programmatically create and use caches without the need of XML configuration file
#webMethods#Integration-Server-and-ESB