Giter Club home page Giter Club logo

Comments (10)

batiste avatar batiste commented on June 10, 2024

Hi,

"Problem. Every content-item ever fetched stays in that dict until Page class is unloaded (forked process dies)"

For me every Page instance should be garbage collected after the view as been executed. The cache dict should be GC as well isn't it?

from django-page-cms.

SardarNL avatar SardarNL commented on June 10, 2024

The dict we are talking about is the class attribute. It will be there until class is unloaded, this isn't implemented in standard CPython as far as I know...

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

Well then it's a bug that need to be fixed. This cache dict are supposed to be by instance only: data attributes, not class attribute. This is a programmatic error that will certainly create some weird bugs.

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

Here is the fix for the issue:

http://github.com/batiste/django-page-cms/commit/bd5af3a430c8b2b8f7478a73eb77df8a4c2118a5

The goal of the cache was only to save some hits on the database/memcached on the instance level, like to avoid to hit the database if the user do that:

{{ page.title }} {{ page.title }} {{ page.title }}

What do you think?

from django-page-cms.

SardarNL avatar SardarNL commented on June 10, 2024

Yes, this should fix it. Thanks!

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

Fixed

from django-page-cms.

mpaolini avatar mpaolini commented on June 10, 2024

Sorry for joining in late...

the issue was non-existent.

As a matter of fact you were declaring the class attributes
but you were always using instance attributes:

in managers.py in method get_content() (around line 215):

       if page._content_dict is None:
            page._content_dict = dict()
        if page._content_dict.get(key, None):
            content_dict = page._content_dict.get(key)
        else:
            content_dict = cache.get(key)

"page" is a Page instance and the first assignment overrides the class attribute.

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

Are you saying that everything is ok? I don't quite remember everything.

from django-page-cms.

mpaolini avatar mpaolini commented on June 10, 2024

everything was OK even before the fix.

The fix just makes it easyer to understand that you're using an instance attribute. And that's good.

by the way, I like this cms, we're using it for our website and I'll be posting some pull requests shortly. Thanks!

from django-page-cms.

batiste avatar batiste commented on June 10, 2024

Nice. I am waiting to see some contributions. Cheers.

from django-page-cms.

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.