Search code examples
apihttptestingpostmanpurge

Does the 'PURGE' method in HTTP only removes the object from cache memory?


I have searched for purge method but didn't found anything precise.

A purge is what happens when you pick out an object from the cache and discard it along with its variants. Usually a purge is invoked through HTTP with the method PURGE. An HTTP purge is similar to an HTTP GET request, except that the method is PURGE.

This is what I found.


Solution

  • That's correct, you can send the PURGE method to remove a resource from the cache. This is a example to illustrate this:

    GET /article/1234 HTTP/1.1

    • The resource is not cached yet
    • Send request to the API
    • Store response in cache and return

    GET /article/1234 HTTP/1.1

    • The resource is cached
    • Return response from cache

    PURGE /article/1234 HTTP/1.1

    • API sends PURGE method to the cache
    • The resources is removed from the cache

    GET /article/1234 HTTP/1.1

    • The resource is not cached yet
    • Send request to the API
    • Store response in cache and return