GithubHelp home page GithubHelp logo

Use case: (PHP) composer cache about cache HOT 6 CLOSED

actions avatar actions commented on May 20, 2024
Use case: (PHP) composer cache

from cache.

Comments (6)

teohhanhui avatar teohhanhui commented on May 20, 2024

If we're able to use something like this, it'd work nicely:

    - name: Cache composer packages
      uses: actions/cache@preview
      with:
        path: ~/.composer/cache/files
        key: composer-${{ date('yyyy') }}-${{ date('mm') }}-${{ date('dd') }}-${{ github.sha }}
        restore-keys: |
          composer-${{ date('yyyy') }}-${{ date('mm') }}-${{ date('dd') }}-
          composer-${{ date('yyyy') }}-${{ date('mm') }}-
          composer-${{ date('yyyy') }}-
          composer-

from cache.

teohhanhui avatar teohhanhui commented on May 20, 2024

Or does the fallback order already use the most recent key first?

from cache.

joshmgross avatar joshmgross commented on May 20, 2024

Hey @teohhanhui, I see you closed this issue, did you get this figured out?

from cache.

teohhanhui avatar teohhanhui commented on May 20, 2024

I think it works just fine assuming that the fallback always uses the most recent cache key (so there's no need for a date function, though that might still be useful for other use cases).

But indeed it'd be great to have an additive cache (updating an existing cache key). In the case of composer, it means we could share the same cache in different jobs with different stability level for the dependencies (e.g. normal, lowest deps, and unstable).

from cache.

dhadka avatar dhadka commented on May 20, 2024

@teohhanhui You are correct, the fallback selects the most recently created cache that matches the restore key prefix.

from cache.

joshmgross avatar joshmgross commented on May 20, 2024

We should have docs coming soon with more details. If you want the date, you do something with action outputs like:

    - name: Set an output
      id: get-date
      run: |
        echo ::set-output name=date::$(/bin/date -u "+%Y%m%d")
    - name: Use the output
      run: |
        echo 'The output date is ${{ steps.get-date.outputs.date }}'

see the docs on outputs.

But as @dhadka said, you should be fine the fallback as is

from cache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.