Re: [dev] running a shortlink provider

From: Spenser Truex <truex_AT_equwal.com>
Date: Thu, 25 May 2023 19:19:21 -0300

On 23/05/25 10:29AM, Anthony wrote:
> On 5/25/23 07:29, Страхиња Радић wrote:
> > Perhaps the most minimal solution for keeping data would be TSV files, but they
> > are not suitable for storing data entered from the web because of concurrency,
> > so a "real" database would be needed.
> >
> What do you mean by, "because of concurrency"?

Performance:

A hash table would be O(1) because you lookup the hash and get it. For a
text file you could only hope for O(log n) with bisecting.

Locks:
No need to lock a hashtable. Needed very much to lock a file though.

I don't support this database heavy database stuff. A key-value pair
dataset would be enough. It's basically a perl one-liner. If you have a
markup language for your database it's bloat.

>
> I know it is insecure, but I would store everything in a txt file where each
> line is a link.

Why is that insecure?

>
> Then you can reach your link with http://myperfectsite.org/<linenumber>

Neat.

>
> If you don't want your id to be consecutive, a tsv file would do the trick
> with a hash then the link.

BINGO

>
> Is there a problem with this approach ?
>

Why use a hammer when you can beat the nail with your hand?

-- 
CAEE B377 FC82 BAF9 102C  D22F C5CE D003 1AA8 E281
Spenser Truex        https://equwal.com

Received on Fri May 26 2023 - 00:19:21 CEST

This archive was generated by hypermail 2.3.0 : Fri May 26 2023 - 00:24:09 CEST