CacheKeys.App.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. namespace JiaZhiQuan.Common
  2. {
  3. public static partial class CacheKeys
  4. {
  5. public const int AppVersionCacheSecs = 60 * 1;
  6. public static string AppVersionAndroid()
  7. {
  8. return GenerateKey("app_version:android");
  9. }
  10. public static string AppVersionIOS()
  11. {
  12. return GenerateKey("app_version:ios");
  13. }
  14. public const int AppRecommendSettingCacheSecs = 60 * 1;
  15. public static string AppRecommendSetting()
  16. {
  17. return GenerateKey("app_recommend_setting");
  18. }
  19. public const int AppNewsUsersCacheSecs = 60 * 1;
  20. public static string AppNewsUsers()
  21. {
  22. return GenerateKey("app_news_users");
  23. }
  24. public const int AppIndexBannerCacheSecs = 60 * 1;
  25. public static string AppIndexBanner()
  26. {
  27. return GenerateKey("app_index_banner");
  28. }
  29. public const int AppIndexBannerPostsCacheSecs = 60 * 1;
  30. public static string AppIndexBannerPosts()
  31. {
  32. return GenerateKey("app_index_banner_posts");
  33. }
  34. public static string AppDeviceOnLine()
  35. {
  36. return GenerateKey("app_device_online");
  37. }
  38. public const int ApiInvocationLimitCacheSecs = 60 * 60;
  39. /// <summary>
  40. /// 接口访问限制,如果次数超过5次,则封禁1小时
  41. /// </summary>
  42. public static string ApiInvocationLimit(string ip)
  43. {
  44. return GenerateKey($"api_inv_limit:{ip}");
  45. }
  46. public const int AppMallIndexBannerCacheSecs = 60 * 1;
  47. public static string AppMallIndexBanner()
  48. {
  49. return GenerateKey("app_mall_index_banner");
  50. }
  51. }
  52. }