-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added clear_persistent_cache and minor update to persistent caching #440
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,6 +82,25 @@ class program_cache : boost::noncopyable | |
m_cache.clear(); | ||
} | ||
|
||
/// Clears persistent cache by deleting the boost_compute folder | ||
void clear_persistent_cache() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this could be a static method (so users can just call |
||
{ | ||
#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE | ||
// Path delimiter symbol for the current OS. | ||
static const std::string delim = boost::filesystem::path("/").make_preferred().string(); | ||
|
||
// Path to appdata folder. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of copying these lines, could you just call |
||
#ifdef WIN32 | ||
static const std::string appdata = detail::getenv("APPDATA") | ||
+ delim + "boost_compute"; | ||
#else | ||
static const std::string appdata = detail::getenv("HOME") | ||
+ delim + ".boost_compute"; | ||
#endif | ||
boost::filesystem::remove_all(appdata); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't remember, but will this through an exception if the offline cache directory hasn't been created yet? If so we should catch/ignore that. |
||
#endif | ||
} | ||
|
||
/// Returns the program object with \p key. Returns a null optional if no | ||
/// program with \p key exists in the cache. | ||
boost::optional<program> get(const std::string &key) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Denis commented, this additional information should already be stored inside the program source and therefore I don't think we need to store it here.