Class GuardRule

java.lang.Object
org.frontcache.guard.GuardRule

public class GuardRule extends Object
A guard rule: name | condition | action. The name is the rule's identity everywhere else - it is written to the failed-requests log as the reason and becomes the metric in the Kibana "Frontcache Rejected Requests" dashboard. Renaming a rule renames the metric.
  • Constructor Details

  • Method Details

    • matches

      public boolean matches(RequestContext context)
      Returns:
      true when EVERY predicate holds (predicates are AND-ed, evaluation short-circuits)
    • getName

      public String getName()
    • getPredicates

      public List<GuardPredicate> getPredicates()
    • getAction

      public GuardAction getAction()
    • isDryRun

      public boolean isDryRun()
    • getHits

      public long getHits()
    • countHit

      public void countHit()
    • getCondition

      public String getCondition()
    • toEntry

      public GuardRuleEntry toEntry()
      Returns:
      flat, JSON-friendly snapshot of this rule for the management API and the console
    • toString

      public String toString()
      Overrides:
      toString in class Object