module ConditionalGet
extend ActiveSupport::Concern
private
def render_conditional(resource, extra: nil)
package com.example.caching.config;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.ShallowEtagHeaderFilter;
import { createHash } from "crypto";
import { Request, Response } from "express";
export function computeEtag(body: string): string {
const digest = createHash("sha1").update(body).digest("base64");
return `"${digest}"`;
module Paginatable
extend ActiveSupport::Concern
Page = Struct.new(:records, :next_cursor, keyword_init: true)
DEFAULT_LIMIT = 25
import hashlib
import json
def compute_etag(payload, weak=False):
body = json.dumps(payload, sort_keys=True, separators=(",", ":"))
require 'digest'
require 'json'
module CacheHelpers
def cache_control_public(max_age = 60)
cache_control :public, :must_revalidate, max_age: max_age