Skip to content

Commit 6639c01

Browse files
committed
Add detailed documentation for get_cache_file function in scitokens_internal.h
1 parent d9f2c49 commit 6639c01

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/scitokens_internal.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ class SimpleCurlGet {
112112

113113
} // namespace internal
114114

115+
/**
116+
* @brief Determines the location of the SciTokens key cache file.
117+
*
118+
* This function checks environment variables and configuration settings to find
119+
* the appropriate directory for the key cache file. It prioritizes the following:
120+
* 1. SCITOKENS_KEYCACHE_FILE environment variable (direct file path).
121+
* 2. Configured cache directory via Configuration::get_cache_home().
122+
* 3. XDG_CACHE_HOME environment variable.
123+
* 4. Default to $HOME/.cache if none of the above are set.
124+
*
125+
* The function ensures the cache directory exists, creates it if necessary,
126+
* initializes the SQLite database if needed, and returns the full path to the
127+
* cache file. Returns an empty string on failure.
128+
*
129+
* @return std::string Full path to the key cache file, or empty string on error.
130+
*/
131+
std::string get_cache_file();
132+
115133
class UnsupportedKeyException : public std::runtime_error {
116134
public:
117135
explicit UnsupportedKeyException(const std::string &msg)

0 commit comments

Comments
 (0)