Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache #49

Closed
RichardLindhout opened this issue Nov 4, 2022 · 13 comments
Closed

Cache #49

RichardLindhout opened this issue Nov 4, 2022 · 13 comments
Assignees
Labels
enhancement New feature or request

Comments

@RichardLindhout
Copy link

It would be nice if there would a cache folder where the already compressed images are in so they won't need a new compression. It takes long to do the images on my website currently so deployment is slower.

@NikolaRHristov
Copy link
Member

NikolaRHristov commented Nov 4, 2022

@RichardLindhout I have thought about that! 😁 But that would require some harder thinking.

@NikolaRHristov
Copy link
Member

But expect it in 1.2.0

@NikolaRHristov NikolaRHristov added the enhancement New feature or request label Nov 4, 2022
@NikolaRHristov
Copy link
Member

NikolaRHristov commented Nov 4, 2022

I noticed the slow build times on https://github.com/nikolaxhristov/astro.build.compress.critters, as well and also some errors ough

@RichardLindhout
Copy link
Author

@NikolaRHristov does this work now, would be really cool!

@NikolaRHristov
Copy link
Member

Hey @RichardLindhout, still not I'm afraid 😅 That's why astro-compress is still version 1.1.x 🤣

@NikolaRHristov
Copy link
Member

I have some time over the weekend so I'll give it a crack.

@RichardLindhout
Copy link
Author

Wow that would be so great!!

@lyleschemmerling
Copy link

Hey @NikolaRHristov Thanks again for opening that PR against FusionAuth!

I know you are trying to pull back from this project, but did you have thoughts on how this would work? I might hack on this and make a PR if you haven't gotten very far.

@NikolaRHristov
Copy link
Member

NikolaRHristov commented Aug 15, 2023

Yeah, no problem! I've been thinking about using the internal git cache of a repository and simply outputting a folder with already processed files. Then just calling that folder to see if something's cached or not. The simplest of things.

sequenceDiagram
    participant User
    participant AstroCompress
    participant Cache
    participant FilesPipe
    participant Git

    User->>AstroCompress: Input Files
    loop Check Cache
        AstroCompress->>Cache: Check if cached
        Cache-->>AstroCompress: Cache status
    end
    alt Cache Found
        AstroCompress->>Cache: Retrieve from Cache
        Cache-->>AstroCompress: Cached Files
    else Cache Not Found
        AstroCompress->>FilesPipe: Process Files
        FilesPipe-->>AstroCompress: Processed Files
        AstroCompress->>Cache: Store in Cache
        Cache-->>AstroCompress: Cache Stored
        AstroCompress->>Git: Commit Processed Files
        Git-->>AstroCompress: Commit ID
    end
    Git->>User: Commit ID
    alt Processed Files Changed
        AstroCompress->>Cache: Replace Cached Files
        Cache-->>AstroCompress: Replacement Done
    end
    AstroCompress->>User: Output Files

That way you can stage that folder in git and have those files persisted, so every time AstroCompress is executed on the CI or somewhere it can have something to work with.

@NikolaRHristov
Copy link
Member

This would ideally be implemented in FilesPipe - https://github.com/NikolaRHristov/FilesPipe

@NikolaRHristov
Copy link
Member

NikolaRHristov commented Aug 15, 2023

This is very well still in its ideation stage and PRs are welcome.

@azat-io
Copy link

azat-io commented Feb 9, 2024

Thank you, I love your package.
Really looking forward to the caching feature.

@NikolaRHristov
Copy link
Member

Thank you, I love your package. Really looking forward to the caching feature.

🙏🏻 Yeah, same, this is a hard feature.

@NikolaRHristov NikolaRHristov closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

4 participants