Add Enum
Inner class
Generic get
Possibly add an auto cleanup?
AC:
Instead of accepting an index, SimpleRedis accepts a SimpleRedisSlot class (which maps to an index internally)
If an enum doesnt have an index yet, it should throw an exception instead of computeIfAbsent
SimpleRedisSlot is a final class that holds index and class (what it will hold)
@Getter
@AllArgsConstructor
public final class SimpleRedisSlot<V> {
public static final SimpleRedisSlot<Leaderboard> LEADERBOARD = new SimpleRedisSlot<>(1, Leaderboard.class);
private final int index;
private final Class<V> clazz;
}
SimpleRedis should be
SimpleRedisProvider.select<T>(Enum) call which returns SimpleRedis<V>SimpleRedis<V> is a new class that will extend ConcurrentHashMap<String, V> (we can swap String for K in the future)
get which will only accept String key (no need to catch exception, will throw anyways if wrong type)