Git Product home page Git Product logo

Comments (5)

howie6879 avatar howie6879 commented on May 17, 2024

Hi @creimers

How do you set ttl?

cache = {
        'cache_class': MemoryCache,
        'cache_config': {},
        'serializer': StrSerializer,
        'ttl': 3
    }

from toapi.

creimers avatar creimers commented on May 17, 2024

Hey @howie6879 ,

my settings look like this. Pretty much how they came out of the generated project.

class MySettings(Settings):

    cache = {
        'cache_class': MemoryCache,
        'cache_config': {},
        'serializer': None,
        'ttl': 60 * 60
    }
    storage = {
        "PATH": os.path.dirname(os.path.abspath(__file__)),
        "DB_URL": None
    }
    web = {
        "with_ajax": False,
        "request_config": {},
        "headers": None
    }

from toapi.

howie6879 avatar howie6879 commented on May 17, 2024

Hi @creimers ,
There is no problem with your settings.
I tried setting ttl: 2 * 3, the result is what I want:

2018/02/01 08:27:51 [Cache   ] OK Set</one/> 
2018/02/01 08:27:51 [Received] OK http://127.0.0.1:5000/one/ 6216 200 42.69ms 
2018/02/01 08:27:54 [Cache   ] OK Get</one/> 
2018/02/01 08:27:54 [Received] OK http://127.0.0.1:5000/one/ 6216 200 0.20ms 
2018/02/01 08:27:58 [Storage ] OK Get<http://wufazhuce.com/> 
2018/02/01 08:27:58 [Parsed  ] OK Item<Indexone[1]> 
2018/02/01 08:27:58 [Parsed  ] OK Item<Indexarticle[4]> 
2018/02/01 08:27:58 [Parsed  ] OK Item<Indexquestion[4]> 
2018/02/01 08:27:58 [Cache   ] OK Set</one/> 

from toapi.

creimers avatar creimers commented on May 17, 2024

Hi. Thanks.

I can confirm that I can reproduce a similar behavior.

However, it is also the case that the results I get to see after the cache has died and new results are fetched are the same as the cached ones. Even if I know for sure that the data source has changed.

Once I delete the .html folder, I do get updated results. Anything I'm missing here?

from toapi.

howie6879 avatar howie6879 commented on May 17, 2024

Hi, @creimers

Sorry for the inconvenience, we allow users to set expiration time in storage, it looks like a bit of a problem now.

We will fix this issue quickly.

Thanks.

from toapi.

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.