Support expirevar for in-memory collection

This commit is contained in:
Martin Vierula
2023-09-29 10:58:43 -07:00
parent 135d1fa42b
commit 118e1b3a44
23 changed files with 5305 additions and 5195 deletions

View File

@@ -1,6 +1,6 @@
/*
* ModSecurity, http://www.modsecurity.org/
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
* Copyright (c) 2015 - 2023 Trustwave Holdings, Inc. (http://www.trustwave.com/)
*
* You may not use this file except in compliance with
* the License. You may obtain a copy of the License at
@@ -16,7 +16,6 @@
#ifdef __cplusplus
#include <string>
#include <iostream>
#include <unordered_map>
#include <list>
#include <vector>
@@ -56,6 +55,8 @@ class Collection {
virtual void del(const std::string& key) = 0;
virtual void setExpiry(const std::string& key, int32_t expiry_seconds) = 0;
virtual std::unique_ptr<std::string> resolveFirst(
const std::string& var) = 0;
@@ -129,6 +130,21 @@ class Collection {
}
/* setExpiry */
virtual void setExpiry(const std::string& key, std::string compartment,
int32_t expiry_seconds) {
std::string nkey = compartment + "::" + key;
setExpiry(nkey, expiry_seconds);
}
virtual void setExpiry(const std::string& key, std::string compartment,
std::string compartment2, int32_t expiry_seconds) {
std::string nkey = compartment + "::" + compartment2 + "::" + key;
setExpiry(nkey, expiry_seconds);
}
/* resolveFirst */
virtual std::unique_ptr<std::string> resolveFirst(const std::string& var,
std::string compartment) {