Clear Cache of Drupal 7 with Custom Code

In my Drupal 7 Website, I have called an Ajax function by the click of a  button to do some Database modifications by different queries. Everything goes well but in the end I need to remove the cache also via code. My file is in /templates folder. I have tried various search functions of drupal to clear cache but nothing works.

Can any drupal 7 expert guide that how to clear the cache.

Note:  I am working on my custom functionality to Revert the Page contents to the last state. Everything goes well but when  I clear the cache then user will be able to see fresh content otherwise not. So I need to clear cache via my ajax code.

Looking forward for reply.

Yuri BoyzSoftware EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Do you read this article?

There is some methods to remove cashe in other situation, if I correct understand your question.
Yuri BoyzSoftware EngineerAuthor Commented:
Yes I have already checked it. But let me test the PHP Code mentioned.
IS there any other update?
And what about javascript?


Open in new window

If you wanr to drop specifics caches, you can try something like this:

ache_clear_all('*', 'cache', TRUE);
    cache_clear_all('*', 'content', TRUE);
    cache_clear_all('*', 'cache_page', TRUE);
    cache_clear_all('*', 'cache_menu', TRUE);
    cache_clear_all('*', 'cache_filter', TRUE);
    cache_clear_all('*', 'cache_view', TRUE);

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Yuri BoyzSoftware EngineerAuthor Commented:
Ok let me check this.
Yuri BoyzSoftware EngineerAuthor Commented:
I have checked your last command but it cannot resolve the issue.
Yuri BoyzSoftware EngineerAuthor Commented:
thanks for this.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.