Coder Social home page Coder Social logo

Comments (10)

cyrildewit avatar cyrildewit commented on May 13, 2024 2

That's a pretty nice solution.

I will also store these time ranges in the seperated table.

from eloquent-viewable.

usman22 avatar usman22 commented on May 13, 2024 1

yeah this will be not possible to tell views for particular days, what if we make a separate table where we'll have one record for each page with a counter attribute, and using it in simple scenario to fetch just total views of a page but if someone asks for views of last month or last hour etc then use original table like we are using right now
Edit: Please use just unique views in other table

from eloquent-viewable.

usman22 avatar usman22 commented on May 13, 2024 1

give it a try and check if it works fine and faster, check my edit in above comment as well

from eloquent-viewable.

usman22 avatar usman22 commented on May 13, 2024

but for how much time we can store in cache if views are increasing in seconds?

from eloquent-viewable.

cyrildewit avatar cyrildewit commented on May 13, 2024

That is the problem we are facing.

from eloquent-viewable.

usman22 avatar usman22 commented on May 13, 2024

so i think cache cannot be best option for this, because views are always increasing in seconds so we should not update cache again and again in seconds

from eloquent-viewable.

cyrildewit avatar cyrildewit commented on May 13, 2024

Maybe adding an extra counter in the JSON object that's done by incrementing. This could be retrieved in a few miliseconds.

Then scheduling a command that recounts this number every hour or day.

Edit: Check my draft under draft ideas.

from eloquent-viewable.

usman22 avatar usman22 commented on May 13, 2024

yes it is a good idea to store the counting of views separately instead of storing a new record on every request that will take a huge space in database as well, and will also be slower while fetching

from eloquent-viewable.

cyrildewit avatar cyrildewit commented on May 13, 2024

But by doing that, we can't ask for the total page views that are maked in the past 30 minutes, 2 days or 2 montsh. I can also make this optional for the users who wants this. functionality.

This sounds to me as a nice solution

from eloquent-viewable.

cyrildewit avatar cyrildewit commented on May 13, 2024

Little update!

I have been working on v2 in the past few days and changed the workflow a little bit.

I think that I found a sweet solution. When the user try to retrieve the page visits of a specific time range, the returned value will be stored in the cache with a time limit.
It is actually a pretty simple solution xD. My first idea was to store these returned values in a different database table, until I released that I could use the cache for this.

I wil also work on a new documentation with more info about the workflow and requirements.

from eloquent-viewable.

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.