package ratelimit
import (
"sync"
"time"
)
-- KEYS[1] = bucket key
-- ARGV: capacity, refillPerSec, now(ms), cost, ttl(sec)
local capacity = tonumber(ARGV[1])
local refill = tonumber(ARGV[2])
local now = tonumber(ARGV[3])
local cost = tonumber(ARGV[4])
package order
type CreateOrderRequest struct {
Reference string `json:"reference" binding:"required,min=3,max=40"`
Currency string `json:"currency" binding:"required,currency"`
Customer Customer `json:"customer" binding:"required"`
class TenantResolver
RESERVED = %w[www app admin].freeze
def initialize(app)
@app = app
end
const MAX_LIMIT = 100;
const DEFAULT_LIMIT = 20;
const ALLOWED_ORDER = new Set(['asc', 'desc']);
function decodeCursor(raw) {
const json = Buffer.from(raw, 'base64').toString('utf8');
module RequestStore
def self.store
Thread.current[:request_store] ||= {}
end
def self.fetch(key)
use std::collections::HashMap;
use std::fmt;
#[derive(Debug, Clone)]
pub struct Document {
pub body: String,
package httpmetrics
import "github.com/prometheus/client_golang/prometheus"
var (
httpRequestDuration = prometheus.NewHistogramVec(
import jwt, { JwtPayload, SignOptions } from 'jsonwebtoken';
const SECRET = process.env.JWT_SECRET as string;
const ISSUER = 'auth.example.com';
const AUDIENCE = 'api.example.com';
-- KEYS[1] = bucket key
-- ARGV[1] = capacity, ARGV[2] = refill_per_sec, ARGV[3] = now (float seconds)
local capacity = tonumber(ARGV[1])
local rate = tonumber(ARGV[2])
local now = tonumber(ARGV[3])
<?php
namespace App\Correlation;
final class CorrelationIdStorage
{
package main
import (
"log"
"net/http"
"time"