From 9fa0576e38559ebe7ff63a8d1161123b049a933b Mon Sep 17 00:00:00 2001 From: Sascha Volkenandt Date: Thu, 31 May 2007 16:23:54 +0000 Subject: - some optimisations - added dropping items out of cache --- filecache.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'filecache.h') 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 #include #include #include @@ -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 ) {} -- cgit v1.2.3