Hello all,

During some optimization rounds we changed the caching configuration for product categories so that the inforamtion will be stored statically and not only for the duration of a request.
This has indeed imporved perormance.
But when attempting to use Redis with this site, we found out that over time Redis consumed very large amounts of memory until it crashed. Further investigation has shown that there many are duplicate entries in Redis.
The largest keys where named "Nop.productcategory.allbyproductid-False-<product id>-<customer id>-1".
Each of these keys one was about 12MB in size and contained information regarding many products and categories, including their images. The duplicates are probably due to the fact that a separate key is created for each new customer. The root of the key is something like this:

[
  {
    "$id": "1",
    "Category": {
      "$id": "2",
      "AppliedDiscounts": [
        {
          "$id": "3",
          "AppliedToCategories": [
            {
              "$id": "4",
              "AppliedDiscounts": [
                {
                  "$ref": "3"
                },
                {
                  "$id": "5",
                  "AppliedToCategories": [
                    {
                      "$ref": "2"
                    },
                    {
                      "$ref": "4"
                    },
                    {
                      "$id": "6",
                      "AppliedDiscounts": [
                        {
                          "$ref": "3"
                        },
                        {
                          "$ref": "5"
                        }
                      ],
                      "Name": "some category name",

It seems that this key is generated in the GetProductCategoriesByProductId function.

We are using nopCommerce 3.70. We checked the 3.90 code and have not found any differences in this area.

Has anyone seen this behavior?
Is there any suggested workaround that would let us use a more aggressive caching policy without assigning huge amount of memory to the Redis server?