use std::collections::HashMap;
use std::hash::Hash;
use std::sync::{Arc, RwLock};
pub struct Memoizer<K, V> {
store: RwLock<HashMap<K, Arc<V>>>,
import { Injectable } from '@nestjs/common';
export interface RateLimitResult {
allowed: boolean;
remaining: number;
limit: number;
export class QueryCache {
constructor() {
this.entries = new Map();
}
getEntry(key) {
use std::collections::HashMap;
#[derive(Debug, PartialEq)]
pub enum LogLevel {
Info,
Warn,
const { z } = require('zod');
const envSchema = z
.object({
NODE_ENV: z
.enum(['development', 'test', 'production'])
class AddSoftDeleteToDocuments < ActiveRecord::Migration[7.0]
def change
add_column :documents, :deleted_at, :datetime
add_index :documents, :deleted_at
# Replace the global unique index with one scoped to live rows,
<?php
namespace App\Http\Controllers;
use App\Jobs\ProcessWebhook;
use App\Support\WebhookSignature;
type Loader<T> = () => Promise<T>;
interface Entry<T> {
value: T;
expiresAt: number;
}
class User < ApplicationRecord
has_many :posts
has_many :comments
scope :digest_subscribers, -> {
where(digest_opt_in: true).where.not(confirmed_at: nil)
<?php
namespace App\Event;
use Symfony\Contracts\EventDispatcher\Event;
class CommentsChannel < ApplicationCable::Channel
def subscribed
post = find_post
if post
stream_for post
else
import { ApplicationConfig } from '@angular/core';
import {
provideHttpClient,
withInterceptors,
} from '@angular/common/http';
import { retryInterceptor } from './retry.interceptor';