BLI: Add dirty and cached checks to shared cache

While these aren't needed that often, it can be helpful to avoid
using a cache if it isn't necessary and it doesn't already exist.
This commit is contained in:
2023-03-22 08:50:27 -04:00
parent 95a4049633
commit 40bd35c9c4

View File

@@ -64,6 +64,22 @@ template<typename T> class SharedCache {
BLI_assert(cache_->mutex.is_cached());
return cache_->data;
}
/**
* Return true if the cache currently does not exist or has been invalidated.
*/
bool is_dirty() const
{
return cache_->mutex.is_dirty();
}
/**
* Return true if the cache exists and is valid.
*/
bool is_cached() const
{
return cache_->mutex.is_cached();
}
};
} // namespace blender