Code Monkey home page Code Monkey logo

Comments (6)

alidevhere avatar alidevhere commented on May 29, 2024 1

@alidevhere Thanks your initial PoC but I'm sorry I cannot accept the PR 🙏

Yes, I made this PR just to show POC i will make a complete PR later

from go-generics-cache.

Code-Hex avatar Code-Hex commented on May 29, 2024

@alidevhere Thanks
What do you think for the usage?

from go-generics-cache.

alidevhere avatar alidevhere commented on May 29, 2024

@Code-Hex I need to add graceful shutdown for my server. If my server restarts it should save whatever in cache and reload when started again.
So if a make little fix and restart it doesnot affect other processes going on.

from go-generics-cache.

Code-Hex avatar Code-Hex commented on May 29, 2024

@alidevhere I see. sounds good.

I think that the development direction should be as follows:

  1. Create new options like WithSave, WithRestore.
  2. WithSave may have a functional parameter like func(cache Interface) {} and this function will be called received context.Done.
  3. WithRestore may have a functional parameter like func(cache Interface) {} and this function will be initialized.

Is it possible to contribute in this way?

from go-generics-cache.

alidevhere avatar alidevhere commented on May 29, 2024

@Code-Hex Yeah sure!!

I have created a proof of concept pull request, I tried to Add Save and Load functions for cache. Let me share my findings with you:

  1. I used gob and gob needs Struct fields to be exported/public to encode and decode them.
  2. It is 100% working with simple cache. But for other algorithm caches we use datastructures like linked list etc. In these cases it is not as straight forward as for simple cache. We will have to do some manual work.

@Code-Hex I will do some more work on it with directions you gave.

Thanks

from go-generics-cache.

Code-Hex avatar Code-Hex commented on May 29, 2024

@alidevhere Thanks your initial PoC but I'm sorry I cannot accept the PR 🙏

from go-generics-cache.

Related Issues (10)

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.