Defining Cache Rules

This article describes the procedures for setting Cache rules.

Cache rules are defined per cluster. These are simple patterns or expressions for ScaleArc to parse against and, if matched, serve directly from ScaleArc’s memory. ScaleArc creates a hash map similar to that of memcached which can achieve up to 12x faster performance than conventional database servers. 

Prior to configuring a cache pattern for a particular database user, make sure you have configured the database for the user in Users & DBs.

ScaleArc provides simple and flexible ways to create cache rules.  Note that cache patterns are case-sensitive. Follow these steps to define and configure Cache Rules:

  1. On the ScaleArc dashboard, navigate to CLUSTERS > Settings column > Transparent Cache.

  2. Click on the Cache Rules tab.


  3. Configure the fields as follows:

    Field Description Default/User Input

    Query caching ON/OFF button

    Query Caching can be explicitly turned OFF or kept ON. You can configure the databases for which query responses need to be cached and specify the patterns or rules that trigger the data cache. Once you have set up these rules, the frequently used queries are offloaded to ScaleArc to reduce your total database load.

    Default is ON.
    Cache limits

    Determines the maximum cache limit. 0 is the default which means unlimited up to the license limit. 

    Default is 0.
    Import Rules

    This feature enables importing the cache rules from a .csv file that was generated from ScaleArc. This option saves you the effort of recreating cache rules; for instance, you can import them from another ScaleArc cluster for reuse. 

    Enter name.
    Export File

    This feature enables exporting all the cache rules into a .csv file so that it can be imported to another ScaleArc or cluster easily.

    Database A list of databases in the cluster. Click on the Gear icon to edit.
    Pattern stats A list of active and inactive patterns in the cluster. Click on the Gear icon to edit.
    Gear icon (edit)

    ScaleArc provides simple and flexible ways to manually create cache rules. 

    Tip: You can also create cache patterns with a one-click option through analytics from real patterns of traffic that have passed through ScaleArc. The API can create cache rules as well and pass it directly through code with a prefix to the SQL statement.
    Click the gear icon to open the Query Pattern edit screen.

Query pattern

The Query screen lets you view and define query patterns with regular expressions that filter the traffic that passes through the ScaleArc interface. You can read more about how Regular Expression patterns work here.

Any query matching a specified pattern is cached within the ScaleArc appliance for the specified TTL (time-to-live). Such cached queries are delivered to the application directly by the ScaleArc appliance significantly faster than the database and this improves the overall performance of your application. Cache patterns added for a particular logical database apply to SQL sessions from any user who executes queries for that logical database. 

  1. On the ScaleArc dashboard, navigate to CLUSTERS > Settings column > Transparent Cache.
  2. Open the Cache Rules tab and click on the gear icon against the database of choice. 


  3. Configure the screen as follows:

    Field Description Default/User input
    Shared cache ON/OFF button

    Allows cache responses to be shared between multiple users for a particluar database, provided they all have the same privileges.

    Default is OFF.
    Add Pattern button Opens the related screen. Create a pattern and ensure that it fits the order in which you want it executed. You cannot edit the pattern in the same field. See below.
    Order Determines the order in which the rules get executed. Switch the order as needed.

    Patterns can include any Perl Compatible Regular Expression. We typically see wild card expression to create simple rules. This option can only be deleted.

    Delete the pattern.

    Defines when the cache expires. 

    Enter a value when you create a pattern.

    Disables or enables a cache rule from executing, depending on its state. You can enable or disable this option during or after you create the pattern.

    The default is enabled. 

    Delete icon

    You can also click on the delete icon to delete the cache rule. 

    Click icon to delete


Add a pattern

ScaleArc provides an easy way to add a pattern to a cache rule.

  1. Click on the Add Pattern button.
  2. Enter the order number.
  3. Tab over and enter the pattern's Regular Expression in the next field.

  4. Enter the TTL value and enable/disable as required.
  5. Click Save
  6. To edit, delete the pattern and recreate, using the Add Pattern button. 
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request