#ifdef HAVE_REDIS_STORAGE_BACKEND
# include <storage/secondary/RedisStorage.hpp>
#endif
+#include <core/CacheEntry.hpp>
#include <util/Bytes.hpp>
#include <util/Timer.hpp>
#include <util/Tokenizer.hpp>
{
MTR_SCOPE("secondary_storage", "put");
+ if (!core::CacheEntry::Header(value).self_contained) {
+ LOG("Not putting {} in secondary storage since it's not self-contained",
+ key.to_string());
+ return;
+ }
+
for (const auto& entry : m_secondary_storages) {
auto backend = get_backend(*entry, key, "putting in", true);
if (!backend) {
expect_stat primary_storage_miss 2 # Try to read manifest for updating
expect_stat secondary_storage_hit 1 # Read manifest for updating
expect_stat secondary_storage_miss 1
+
+ # -------------------------------------------------------------------------
+ if touch test.c && ln test.c test-if-fs-supports-hard-links.c 2>/dev/null; then
+ TEST "Don't reshare results with raw files"
+
+ CCACHE_SECONDARY_STORAGE= CCACHE_HARDLINK=1 $CCACHE_COMPILE -c test.c
+ expect_stat direct_cache_hit 0
+ expect_stat cache_miss 1
+ expect_stat files_in_cache 3
+ expect_stat primary_storage_hit 0
+ expect_stat primary_storage_miss 2 # result + manifest
+ expect_stat secondary_storage_hit 0
+ expect_stat secondary_storage_miss 0
+
+ CCACHE_RESHARE=1 $CCACHE_COMPILE -c test.c
+ expect_stat direct_cache_hit 1
+ expect_stat cache_miss 1
+ expect_stat files_in_cache 3
+ expect_stat primary_storage_hit 2
+ expect_stat primary_storage_miss 2 # result + manifest
+ expect_stat secondary_storage_hit 0
+ expect_stat secondary_storage_miss 0
+ expect_file_count 2 '*' secondary # CACHEDIR.TAG + manifest, not result
+ fi
}