Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
dea0cc16
Commit
dea0cc16
authored
Feb 16, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/cache/Manager: add method Flush()
parent
07e0a31d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
Manager.cxx
src/input/cache/Manager.cxx
+16
-0
Manager.hxx
src/input/cache/Manager.hxx
+2
-0
No files found.
src/input/cache/Manager.cxx
View file @
dea0cc16
...
...
@@ -58,6 +58,22 @@ InputCacheManager::~InputCacheManager() noexcept
items_by_time
.
clear_and_dispose
(
DeleteDisposer
());
}
void
InputCacheManager
::
Flush
()
noexcept
{
items_by_time
.
remove_and_dispose_if
([](
const
InputCacheItem
&
item
){
return
!
item
.
IsInUse
();
},
[
this
](
InputCacheItem
*
item
){
// TODO: eliminate code duplication, see method Remove()
assert
(
total_size
>=
item
->
size
());
total_size
-=
item
->
size
();
items_by_uri
.
erase
(
items_by_uri
.
iterator_to
(
*
item
));
delete
item
;
});
// TODO: invalidate busy items and flush them later
}
bool
InputCacheManager
::
IsEligible
(
const
InputStream
&
input
)
noexcept
{
...
...
src/input/cache/Manager.hxx
View file @
dea0cc16
...
...
@@ -72,6 +72,8 @@ public:
explicit
InputCacheManager
(
const
InputCacheConfig
&
config
)
noexcept
;
~
InputCacheManager
()
noexcept
;
void
Flush
()
noexcept
;
gcc_pure
bool
Contains
(
const
char
*
uri
)
noexcept
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment