Skip to content

AbsoluteExpiry of caller overridden/ignored if child called that causes cache entry with shorter expiry #10962

Open

Description

@LittleColin

If method A caches for 12 hours and calls method B which caches for 5 minutes, the result for method A will only be cached for 5 minutes.

Logically this appears to make sense but this happens without the caller for Method A knowing about it. Consider the situation where method A goes on to make calls to a system that has a quota that mustn't be called too frequently. There should at least be an error if Method A has set an absolute expiry that is subsequently ignored/overridden by the call to Method B.

It relates to this change:
aspnet/Caching@f15fb80#diff-9968fc5543acfd05fa60089bd344679bR102

The actual behaviour appears to contradict the bullet point above but that could depend on your interpretation of which is child and which is parent in the scenario I've described: "When one cache entry is used to create another, the child copies the parent entry's expiration tokens and time-based expiration settings. The child isn't expired by manual removal or updating of the parent entry."

I've put a code example here: https://sartorialsolutions.wordpress.com/2019/02/15/aspnetcore-memorycache-magic-dependencies-and-danger/


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. added
    Source - Docs.ms
    on Feb 15, 2019
  2. added this to the Backlog milestone on Feb 15, 2019
  3. Rick-Anderson commented on Feb 15, 2019

    @Rick-Anderson
    Contributor

    there should at least be an error if Method A has set an absolute expiry

    You can open a issue for that at https://github.com/aspnet/AspNetCore/issues

    The actual behaviour appears to contradict the bullet point above

    What bullet point in the doc? What would you like see changed in the doc?

  4. LittleColin commented on Feb 18, 2019

    @LittleColin
    Author

    Thanks for the response @Rick-Anderson. The bullet point was the part I quoted (it was "above" when I created this issue on https://docs.microsoft.com/...):

    "When one cache entry is used to create another, the child copies the parent entry’s expiration tokens and time-based expiration settings. The child isn’t expired by manual removal or updating of the parent entry."

    But perhaps this is talking about an entirely different scenario of creating child cache items.

  5. mkArtakMSFT commented on Jun 29, 2020

    @mkArtakMSFT
    Contributor

    @ericstj another caching related issue.

  6. ericstj commented on Jun 30, 2020

    @ericstj
    Member
  7. ericstj commented on Jun 30, 2020

    @ericstj
    Member

    Also cc @sebastienros who made the change referenced here.

  8. added
    area-runtime-extensions
    on Jul 2, 2020
  9. Rick-Anderson commented on Sep 29, 2022

    @Rick-Anderson
    Contributor
  10. added
    re-Aditya
    and removed on Oct 24, 2022
  11. mkArtakMSFT commented on Oct 24, 2022

    @mkArtakMSFT
    Contributor

    Fixed and rerouted to @adityamandaleeka

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Source - Docs.msarea-runtime-extensionsdoc-bugre-Aditya

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions