class LeaderboardCache
TOP_KEY = "leaderboard:top".freeze
STATS_KEY = "leaderboard:stats".freeze
def top_players
Rails.cache.fetch(TOP_KEY, expires_in: 5.minutes, race_condition_ttl: 15.seconds) do
class CreateWebhookEvents < ActiveRecord::Migration[7.1]
def change
create_table :webhook_events do |t|
t.string :event_id, null: false
t.string :source, null: false, default: "stripe"
t.string :event_type, null: false
class CreateOutboxEvents < ActiveRecord::Migration[7.1]
def change
create_table :outbox_events do |t|
t.string :event_type, null: false
t.string :aggregate_type, null: false
t.string :aggregate_id, null: false
use serde::Deserialize;
use std::fmt;
#[derive(Debug, Deserialize)]
pub struct UserRecord {
pub name: String,
const express = require('express');
const webhookRouter = require('./webhookRouter');
const apiRouter = require('./apiRouter');
const app = express();
use std::fs;
use std::path::Path;
#[derive(Debug, Clone)]
pub struct Migration {
pub version: i64,
package com.example.health;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
package httpretry
import (
"math/rand"
"time"
)
package retry
import (
"context"
"math/rand"
"time"
class DeliveryObserver
def self.delivered_email(message)
new(message).record
end
def initialize(message)
package config
import (
"io"
"gopkg.in/yaml.v3"
package com.example.orders.event;
import java.math.BigDecimal;
import java.time.Instant;
public final class OrderPlacedEvent {