aboutsummaryrefslogtreecommitdiff
path: root/paludis/repository_name_cache.hh
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-07 02:20:15 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-07 02:20:15 +0000
commit558d9af4849ff4fd1374f8852201b890689c7a51 (patch)
tree8ab7ac3751b0a81ac04c50e494737bde605a1904 /paludis/repository_name_cache.hh
parentb808a1281c94b0bd006bbb16a69a114f962f9cc3 (diff)
downloadpaludis-558d9af4849ff4fd1374f8852201b890689c7a51.tar.gz
paludis-558d9af4849ff4fd1374f8852201b890689c7a51.tar.xz
Split out common cache code. Make the cache more sensitive to misuse.
Diffstat (limited to 'paludis/repository_name_cache.hh')
-rw-r--r--paludis/repository_name_cache.hh56
1 files changed, 56 insertions, 0 deletions
diff --git a/paludis/repository_name_cache.hh b/paludis/repository_name_cache.hh
new file mode 100644
index 000000000..0b7a716f8
--- /dev/null
+++ b/paludis/repository_name_cache.hh
@@ -0,0 +1,56 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_CACHE_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORY_NAME_CACHE_HH 1
+
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/name.hh>
+
+namespace paludis
+{
+ class FSEntry;
+ class Repository;
+
+ class RepositoryNameCache :
+ public InternalCounted<RepositoryNameCache>,
+ private PrivateImplementationPattern<RepositoryNameCache>
+ {
+ private:
+ mutable bool _usable;
+
+ public:
+ RepositoryNameCache(
+ const FSEntry & location,
+ const Repository * const repo);
+ virtual ~RepositoryNameCache();
+
+ CategoryNamePartCollection::ConstPointer category_names_containing_package(
+ const PackageNamePart & p) const;
+
+ bool usable() const PALUDIS_ATTRIBUTE((nothrow))
+ {
+ return _usable;
+ }
+
+ void regenerate_cache() const;
+ };
+}
+
+#endif