summaryrefslogtreecommitdiff
path: root/filecache.h
diff options
context:
space:
mode:
authorSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-05-31 16:23:54 +0000
committerSascha Volkenandt <sascha (at) akv-soft (dot) de>2007-05-31 16:23:54 +0000
commit9fa0576e38559ebe7ff63a8d1161123b049a933b (patch)
tree276c6b65a024f7bcb7bd72b8fb623ae135b0091a /filecache.h
parent98e68abaf03928f29dd3fa1252d20ceb3b08144a (diff)
downloadvdr-plugin-live-9fa0576e38559ebe7ff63a8d1161123b049a933b.tar.gz
vdr-plugin-live-9fa0576e38559ebe7ff63a8d1161123b049a933b.tar.bz2
- some optimisations
- added dropping items out of cache
Diffstat (limited to 'filecache.h')
-rw-r--r--filecache.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/filecache.h b/filecache.h
index 0556616..89d884f 100644
--- a/filecache.h
+++ b/filecache.h
@@ -1,6 +1,7 @@
#ifndef VDR_LIVE_FILECACHE_H
#define VDR_LIVE_FILECACHE_H
+#include <numeric>
#include <string>
#include <vector>
#include <vdr/tools.h>
@@ -12,12 +13,12 @@ class FileObject
{
public:
FileObject( std::string const& path )
- : m_ctime( 0 )
+ : m_ctime( std::numeric_limits< std::time_t >::max() )
, m_path( path ) {}
std::size_t size() const { return m_data.size(); }
std::size_t weight() const { return size(); }
- bool is_current() const;
+ bool is_current() const { return m_ctime == get_filetime( m_path ); }
bool load();
char const* data() const { return &m_data[0]; }
std::time_t ctime() const { return m_ctime; }
@@ -33,6 +34,7 @@ private:
class FileCache: public vgstools::cache< std::string, FileObject >
{
typedef vgstools::cache< std::string, FileObject > base_type;
+
public:
FileCache( size_t maxWeight ): base_type( maxWeight ) {}