You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
create table _check (
id bigserial not null,
created_at timestamp(6) not null,
total_price numeric(38, 2) not null,
discount_card_id bigint,
primary key (id)
);
create table discount_card (
id bigserial not null,
discount integer not null,
primary key (id)
);
create table position (
id bigserial not null,
quantity integer not null,
total_price numeric(38, 2) not null,
check_id bigint,
product_id bigint not null,
primary key (id)
);
create table product (
id bigserial not null,
name varchar(255) not null,
price numeric(40, 2) not null,
promotional boolean not null,
primary key (id)
);
alter table if exists _check
add constraint fk_discount_card_id
foreign key (discount_card_id)
references discount_card;
alter table if exists position
add constraint fk_check_id
foreign key (check_id)
references _check;
alter table if exists position
add constraint fk_product_id
foreign key (product_id)
references product;
5. Caching
In this project, caching is implemented using a custom in-memory cache using LRU and LFU algorithms.
Caches are represented by two classes: LFUCache and LRUCache.
Both classes implement the Cache<K, V> interface, where K is a typed parameter for the cache entry key, and V is the value of the cache entry.
Each cache has three methods:
boolean put(K key, V value)
Optional<V> get(K key)
boolean remove(K key)
More information about cache methods can be found in the javadoc of the Cache<K, V> interface.