Return the cache directory for the current context.



In most cases, this function returns the user's cache directory, by calling tools::R_user_dir("sass", which = "cache") (for R 4.0 and above) or rappdirs::user_cache_dir("R-sass") (for older versions of R).

If this function is called from a Shiny application, it will also look for a subdirectory named app_cache/. If it exists, it will use a directory named app_cache/sass/ to store the cache.

When running a Shiny application in a typical R session, it will not create the app_cache/ subdirectory, but it will use it if present. This scopes the cache to the application.

With Shiny applications hosted on Shiny Server and Connect, it will create a app_cache/sass/ subdirectory, so that the cache is scoped to the application and will not interfere with another application's cache.