mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
Support expirevar for in-memory collection
This commit is contained in:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user