The caching mechanism in Oracle WebCenter Sites (OWCS) is undoubtedly one of its major selling points. OWCS is preconfigured with two caching layers at page level, namely Sites cache (or cs cache) & Satellite cache (or ss cache). This duo is famously known for their “Double Buffered Caching” intelligence. There are also further levels of caching in OWCS (like Asset cache, URL cache & Blob cache) that complement Page cache building/assembling for quick turnaround.
In this two-blog series, we will discuss in detail the page caching techniques in OWCS, beginning with this basic course and progressing to an advanced course in Part 2. This is very useful for developers.
Setting Cache Rules
The “Cache Rules” field must be set to value “Cached” when the HTML fragment expected to output from the corresponding Template must be cached (see Screenshot-1 below, the highlighted area marked in yellow). OWCS also offers an advanced mechanism to cache a particular template at cs-cache OR ss-cache level only.
Usually developers uncache the template(s) during the development phase for easy debugging and later forget to Cache them back before propagating them to higher environments. This should be avoided.
Setting Cache Criteria
The “Cache Criteria” field has a list of comma-separated parameters which serve together as primary identifiers to create/read a page(let) cache copy in OWCS (see Screenshot-1 below, the highlighted area marked in green). Append your new parameters to existing cache criteria, but don’t ever replace them. The default ones are there for a purpose.
For example, assume a requirement to render Hero Banner on a Home page with content authors having the ability to decide the background color and horizontal/vertical orientation of the hero banner. To realize this in OWCS, Template “Page/HeroBanner” is created, which is called from Template “Page/Home” along with the arguments “color, style” as shown below.
The arguments here are dynamic and can hold any value as contributed by the author. Each pagelet is cached independently, along with all the parameter values that were passed in the cache criteria. So, the developer needs to instruct OWCS on what criteria a template needs in order to be cached.
Cache copies combinations may end up like this:
- Cache copy 1: color=blue and style=horizontal
- Cache copy 2: color=red and style=vertical
- Cache copy 3: color=red and style=horizontal
- … and so on.
So, what happens when the parameters are not added to cache criteria?
On the very first request, let’s say the parameter values for color and style are blue and horizontal, respectively. OWCS then caches a hero banner HTML that has a blue background and horizontal orientation. However, on subsequent requests with different color and style parameter values passed, OWCS doesn’t recognize the need to regenerate a new cache as it is ignorant of criteria. It simply picks the existing cache copy (blue & horizontal combination) and serves it back.
Stay tuned for the next blog in this 2-part series to learn the ADVANCED caching techniques that will help you leverage better caching in OWCS.
If you’d like help upgrading your Oracle WebCenter Sites environment from 11g to 12c before the December Premier Support deadline, contact us at Inspired ECM to let our experienced consultants get your environment running efficiently and successfully today.