Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
74570104
Commit
74570104
authored
May 20, 2014
by
Hugo Beauzée-Luyssen
Browse files
Cache: Allow deletion by cache key
parent
89ee7fbe
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Cache.h
View file @
74570104
...
...
@@ -102,11 +102,9 @@ class Cache
return
res
;
}
static
bool
destroy
(
sqlite3
*
dbConnection
,
const
std
::
shared_ptr
<
IMPL
>&
self
)
static
bool
destroy
(
sqlite3
*
dbConnection
,
const
typename
CACHEPOLICY
::
KeyType
&
key
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
Mutex
);
auto
key
=
CACHEPOLICY
::
key
(
self
);
auto
it
=
Store
.
find
(
key
);
if
(
it
!=
Store
.
end
()
)
Store
.
erase
(
it
);
...
...
@@ -115,6 +113,12 @@ class Cache
return
SqliteTools
::
executeDelete
(
dbConnection
,
req
.
c_str
(),
key
);
}
static
bool
destroy
(
sqlite3
*
dbConnection
,
const
std
::
shared_ptr
<
IMPL
>&
self
)
{
const
auto
&
key
=
CACHEPOLICY
::
key
(
self
);
return
destroy
(
dbConnection
,
key
);
}
private:
static
std
::
unordered_map
<
typename
CACHEPOLICY
::
KeyType
,
std
::
shared_ptr
<
IMPL
>
>
Store
;
static
std
::
mutex
Mutex
;
...
...
src/MediaLibrary.cpp
View file @
74570104
...
...
@@ -60,8 +60,7 @@ LabelPtr MediaLibrary::createLabel( const std::string& label )
bool
MediaLibrary
::
deleteLabel
(
const
std
::
string
&
text
)
{
auto
label
=
Label
::
fetch
(
m_dbConnection
,
text
);
return
deleteLabel
(
label
);
return
Label
::
destroy
(
m_dbConnection
,
text
);
}
bool
MediaLibrary
::
deleteLabel
(
LabelPtr
label
)
...
...
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