Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8563453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:57:49+00:00 2026-06-11T16:57:49+00:00

I am working on live blogging platform which must be implemented using CakePhp or

  • 0

I am working on live blogging platform which must be implemented using CakePhp or Php.
It must handle 1000 of users at a time.

I’ve done this by auto refreshing the content using ajax when a new data is inserted in mysql table. The problem is that it hits the DB every 10 seconds to check whether the data is inserted in the past 60 seconds. If the count results 1 then I programmed to refresh the content.But it doesn’t feel like an optimised solution.

Is there any way to implement this?

My code – ajax call to livefeed controller :

var auto_refresh = setInterval(
  function()
  { 
    $.post('/blog/posts/liveFeed', function(data) {
    if(data >0){
      alert(data);
      $('#content').load(window.location.href);
    }
  });
  return false;
}, 10000);

Livefeed controller in posts.php:

public function liveFeed() {
  $res=$this->Post->query('SELECT count(*) AS data FROM posts where TIME_TO_SEC(TIMEDIFF(NOW(), created)) < 60');
  echo $res[0][0]['data'];
}

I’m not good at cakePhp. So forgive me If my code looks unprofessional.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:57:50+00:00Added an answer on June 11, 2026 at 4:57 pm

    You could use some caching.

    Use an http-cache like varnish and reset it every time a new article gets written – Otherwise just deliver the html page from varnish. That should give you a considerable boost in speed and possible users.

    You can still reload the page every 10 seconds with an ajax request – It would just load the cached page and not query the database every time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm working with Flash Live Encoder. It's using camera for streaming video. Support forum
I'm working on a live photo stream app. Essentially, users will be uploading photos
Hi I have been trying to get this script http://jsbin.com/ipajo5/ working but using .live()
I was working on streaming audio live using the Audio Streaming Services library (based
I'm trying to get a live progress indicator working on my php CLI app.
I'm working on streaming live video to ipad/iphone using apple's http live streaming. One
I've been working on a thread which will live as long as the application
ive got working live search with ajax and php JQUERY: $(#search).keyup(function() { var search_input
I am working on an live audio streaming project, in which the live audio
If I'm working on live branch as well as development branch at almost same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.