```ts
import { from } from 'core-js';

export class LruCache<K extends string | number | symbol, V> {
  private cache: Map<K, [V, Date]> = new Map();
  private capacity: number;
  private maxSize: number;

  constructor(capacity: number) {
    if (capacity <= 0 || !Number.isInteger(capacity)) {
      throw new Error('Capacity must be a positive integer');
    }
    this.capacity = capacity;
    this.maxSize = capacity * 1.3; // Buffer by 30%
  }

  private updateUsage(key: K) {
    const existingEntry = this.cache.get(key);
    if (existingEntry) {
      existingEntry[1] = new Date();
    } else {
      // If key doesn't exist, increase size limit to account for future adds
      if (this.cache.size >= this.maxSize) {
        this.evictLeastRecentlyUsed();
      }
      this.cache.set(key, [undefined, new Date()]);
      this.maxSize += 1; // Buffer to prevent immediate eviction on next set
    }
  }

  get(key: K): V | undefined {
    const entry = this.cache.get(key);
    if (entry) {
      entry[1] = new Date(); // Mark as used
      return entry[0];
    }
    return undefined;
  }

  set(key: K, value: V): void {
    this.updateUsage(key);
    this.cache.set(key, [value, new Date()]);
  }

  get size(): number {
    return this.cache.size;
  }

  private evictLeastRecentlyUsed() {
    const entries = Array.from(this.cache.entries())
      .sort((a, b) => a[1][1] - b[1][1]).slice(0, 1)[0];
    if (entries) {
      this.cache.delete(entries[0]);
    }
  }
}
```