Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Well yes, I can think of at least a way I’d do this:

    1. Pull a list of popular posts objects (eg. top 10 viewed within the last 24 hours.)
    2. Store said list either as an array on your database or as a .json file for ease of access and for caching (you want to reduce the number of database read operations to help performance.)
    3. Write a function that reads this array/json file and tells you whether a provided post ID is in said data storage, and if it is then return its position in it (eg. 8th).

    This function could be written in a way that it’ll pull a fixed & customizable number of popular items (I would limit the amount of items for performance reasons as well) and have it “cache” -as explained above- the data for a period of time since you most likely don’t need real-time data.

    That’s my two cents. If you need help writing said function please let me know and I’d be glad to help.

    Thread Starter Ted Slater

    (@tedslater)

    Héctor, you are my favorite developer whom I’m yet to meet. That’s super helpful. I don’t need any help making this happen at the moment. But if I do, I’m happy to pay you for the service.

    I trust all’s well for you and your family in the beautiful country of Venezuela.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Knowing a post’s rank over the past 24 hours’ is closed to new replies.