question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wishlist: Make cache key elements explicit

See original GitHub issue

Type: Feature Task Name: CacheBeta@1

Environment

Azure Pipelines - but this is a feature wishlist item, not a bug, Hosted agent

Issue Description

The current method of specifying a cache key has several issues.

First, it’s very easy to generate invalid YAML with it, just by wanting to put literal strings first:

key: "v1" | some-file.txt

This is invalid because parsers see the double quote and assume that they value will be entirely quoted. There is a disgusting workaround, of course:

key: '"v1" | some-file.txt'

But this is a real eyesore!

The other issue is that we have to guess whether the task will interpret any given element as a path or not.

I propose a more explicit system for specifying the key where each key element is an array element:

key:
  - literal: v1
  - path: some-file.txt
  - literal: some-file-name

This is entirely unambiguous and doesn’t require any odd double-quoting. As a bonus, this makes it trivial to introduce new types of key elements in the future if that is ever needed.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
autarchcommented, Nov 5, 2019

You will pry Emacs from my cold, dead hands, which will be curled into some unnatural Ctrl-Alt-Shift-$Letter shape.

0reactions
samuelkoppescommented, Jun 25, 2020

We do not have a good way to implement this in YAML without introducing further syntactic complexity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding the cache key - Amazon CloudFront
The cache key determines whether a viewer request to a CloudFront edge location results in a cache hit. The cache key is the...
Read more >
Caching - WishList Products Knowledgebase
WishList Member makes use of built-in WordPress caching functions to cache data which may be computationally expensive to regenerate.
Read more >
Caching Strategies for Salesforce B2C Commerce
Caching Strategies for Salesforce B2C Commerce. Every merchant strives to have a fast and reliable website as the foundation of their shopper experience....
Read more >
Cache Implementations in C# .NET | Michael's Coding Spot
Let's create a very simple cache implementation in C#: ... ContainsKey(key)) { _cache[key] = createItem(); } return _cache[key]; } ...
Read more >
Manipulating the cache key | Fastly Help Guides
You can set the cache key explicitly (including attaching conditions) by adding a request setting via the Settings page in the configuration ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found