nsCache.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * This Source Code Form is subject to the terms of the Mozilla Public
  4. * License, v. 2.0. If a copy of the MPL was not distributed with this
  5. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  6. /**
  7. * Cache Service Utility Functions
  8. */
  9. #ifndef _nsCache_h_
  10. #define _nsCache_h_
  11. #include "mozilla/Logging.h"
  12. #include "nsISupports.h"
  13. #include "nsIFile.h"
  14. #include "nsAString.h"
  15. #include "prtime.h"
  16. #include "nsError.h"
  17. // PR_LOG args = "format string", arg, arg, ...
  18. extern mozilla::LazyLogModule gCacheLog;
  19. void CacheLogPrintPath(mozilla::LogLevel level,
  20. const char * format,
  21. nsIFile * item);
  22. #define CACHE_LOG_INFO(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Info, args)
  23. #define CACHE_LOG_ERROR(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Error, args)
  24. #define CACHE_LOG_WARNING(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Warning, args)
  25. #define CACHE_LOG_DEBUG(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Debug, args)
  26. #define CACHE_LOG_PATH(level, format, item) \
  27. CacheLogPrintPath(level, format, item)
  28. extern uint32_t SecondsFromPRTime(PRTime prTime);
  29. extern PRTime PRTimeFromSeconds(uint32_t seconds);
  30. extern nsresult ClientIDFromCacheKey(const nsACString& key, char ** result);
  31. extern nsresult ClientKeyFromCacheKey(const nsCString& key, nsACString &result);
  32. #endif // _nsCache_h