5G-MAG Reference Tools - MBMS Middleware
src
CacheManagement.h
Go to the documentation of this file.
1
// 5G-MAG Reference Tools
2
// MBMS Middleware Process
3
//
4
// Copyright (C) 2021 Klaus Kühnhammer (Österreichische Rundfunksender GmbH & Co KG)
5
//
6
// Licensed under the License terms and conditions for use, reproduction, and
7
// distribution of 5G-MAG software (the “License”). You may not use this file
8
// except in compliance with the License. You may obtain a copy of the License at
9
// https://www.5g-mag.com/reference-tools. Unless required by applicable law or
10
// agreed to in writing, software distributed under the License is distributed on
11
// an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12
// or implied.
13
//
14
// See the License for the specific language governing permissions and limitations
15
// under the License.
16
//
17
18
#pragma once
19
20
#include <libconfig.h++>
21
#include <boost/asio.hpp>
22
#include "
CacheItems.h
"
23
24
namespace
MBMS_RT
{
25
class
CacheManagement
{
26
public
:
27
CacheManagement
(
const
libconfig::Config&
cfg
, boost::asio::io_service& io_service);
28
virtual
~CacheManagement
() =
default
;
29
30
void
add_item
(std::shared_ptr<CacheItem> item) {
31
_cache_items
[item->content_location()] = item;
32
};
33
void
remove_item
(
const
std::string& location) {
_cache_items
.erase(location); };
34
const
std::map<std::string, std::shared_ptr<CacheItem>>&
item_map
()
const
{
return
_cache_items
; };
35
36
void
check_file_expiry_and_cache_size
();
37
38
39
private
:
40
std::map<std::string, std::shared_ptr<CacheItem>>
_cache_items
;
41
unsigned
_max_cache_size
= 512;
42
unsigned
_total_cache_size
= 0;
43
unsigned
_max_cache_file_age
= 30;
44
boost::asio::io_service&
_io_service
;
45
};
46
}
CacheItems.h
MBMS_RT::CacheManagement
Definition:
CacheManagement.h:25
MBMS_RT::CacheManagement::CacheManagement
CacheManagement(const libconfig::Config &cfg, boost::asio::io_service &io_service)
Definition:
CacheManagement.cpp:21
MBMS_RT::CacheManagement::_io_service
boost::asio::io_service & _io_service
Definition:
CacheManagement.h:44
MBMS_RT::CacheManagement::_total_cache_size
unsigned _total_cache_size
Definition:
CacheManagement.h:42
MBMS_RT::CacheManagement::_max_cache_size
unsigned _max_cache_size
Definition:
CacheManagement.h:41
MBMS_RT::CacheManagement::check_file_expiry_and_cache_size
void check_file_expiry_and_cache_size()
Definition:
CacheManagement.cpp:29
MBMS_RT::CacheManagement::~CacheManagement
virtual ~CacheManagement()=default
MBMS_RT::CacheManagement::remove_item
void remove_item(const std::string &location)
Definition:
CacheManagement.h:33
MBMS_RT::CacheManagement::item_map
const std::map< std::string, std::shared_ptr< CacheItem > > & item_map() const
Definition:
CacheManagement.h:34
MBMS_RT::CacheManagement::add_item
void add_item(std::shared_ptr< CacheItem > item)
Definition:
CacheManagement.h:30
MBMS_RT::CacheManagement::_cache_items
std::map< std::string, std::shared_ptr< CacheItem > > _cache_items
Definition:
CacheManagement.h:40
MBMS_RT::CacheManagement::_max_cache_file_age
unsigned _max_cache_file_age
Definition:
CacheManagement.h:43
cfg
static Config cfg
Global configuration object.
Definition:
main.cpp:111
MBMS_RT
Definition:
CacheItems.h:25
Generated by
1.9.1